package com.gisocn.onemap.ui.activity;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.hardware.display.VirtualDisplay;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.media.Image;
import android.media.ImageReader;
import android.media.projection.MediaProjection;
import android.media.projection.MediaProjectionManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import androidx.core.internal.view.SupportMenu;
import androidx.core.view.GravityCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.services.core.AMapException;
import com.amap.api.services.core.LatLonPoint;
import com.amap.api.services.core.PoiItem;
import com.amap.api.services.core.ServiceSettings;
import com.amap.api.services.poisearch.PoiResult;
import com.amap.api.services.poisearch.PoiSearch;
import com.bumptech.glide.Glide;
import com.esri.android.map.GraphicsLayer;
import com.esri.android.map.Layer;
import com.esri.android.map.LocationDisplayManager;
import com.esri.android.map.MapView;
import com.esri.android.map.ags.ArcGISDynamicMapServiceLayer;
import com.esri.android.map.ags.ArcGISLayerInfo;
import com.esri.android.map.ags.ArcGISLocalTiledLayer;
import com.esri.android.map.ags.ArcGISTiledMapServiceLayer;
import com.esri.android.map.event.OnSingleTapListener;
import com.esri.android.map.event.OnStatusChangedListener;
import com.esri.android.map.event.OnZoomListener;
import com.esri.android.runtime.ArcGISRuntime;
import com.esri.core.geometry.Envelope;
import com.esri.core.geometry.Geometry;
import com.esri.core.geometry.GeometryEngine;
import com.esri.core.geometry.Point;
import com.esri.core.geometry.Polygon;
import com.esri.core.geometry.Polyline;
import com.esri.core.geometry.SpatialReference;
import com.esri.core.map.Feature;
import com.esri.core.map.FeatureResult;
import com.esri.core.map.FeatureSet;
import com.esri.core.map.Field;
import com.esri.core.map.Graphic;
import com.esri.core.symbol.PictureMarkerSymbol;
import com.esri.core.symbol.SimpleFillSymbol;
import com.esri.core.symbol.SimpleLineSymbol;
import com.esri.core.symbol.SimpleMarkerSymbol;
import com.esri.core.symbol.Symbol;
import com.esri.core.tasks.ags.query.Query;
import com.esri.core.tasks.ags.query.QueryTask;
import com.esri.core.tasks.query.QueryParameters;
import com.gisocn.onemap.BuildConfig;
import com.gisocn.onemap.base.BaseActivity;
import com.gisocn.onemap.base.CommonAdapter;
import com.gisocn.onemap.base.Constant;
import com.gisocn.onemap.base.MultiItemTypeAdapter;
import com.gisocn.onemap.base.ViewHolder;
import com.gisocn.onemap.event.MessageEvent;
import com.gisocn.onemap.interfaces.OnItemClickChildListener;
import com.gisocn.onemap.interfaces.OnItemClickListener;
import com.gisocn.onemap.model.AboutSoftware;
import com.gisocn.onemap.model.AppConfig;
import com.gisocn.onemap.model.AppVersion;
import com.gisocn.onemap.model.BaseMap;
import com.gisocn.onemap.model.DynamicInfo;
import com.gisocn.onemap.model.DynamicLayerInfo;
import com.gisocn.onemap.model.DynamicMapServiceLayer;
import com.gisocn.onemap.model.ImgCLayer;
import com.gisocn.onemap.model.LandInfo;
import com.gisocn.onemap.model.LayerInfoBean;
import com.gisocn.onemap.model.LayerParamDefine;
import com.gisocn.onemap.model.LayerQueryInfo;
import com.gisocn.onemap.model.LocalFileInfo;
import com.gisocn.onemap.model.PencilInfo;
import com.gisocn.onemap.model.PhotoInfo;
import com.gisocn.onemap.model.QueryXML;
import com.gisocn.onemap.model.Statistic;
import com.gisocn.onemap.model.TDTInfo;
import com.gisocn.onemap.model.TDTType;
import com.gisocn.onemap.model.VectorQuery;
import com.gisocn.onemap.model.VersionLog;
import com.gisocn.onemap.presenter.MainPresenter;
import com.gisocn.onemap.sgzx.R;
import com.gisocn.onemap.tdt.TDTConstant;
import com.gisocn.onemap.tdt.TDTTiedMapLayer;
import com.gisocn.onemap.ui.adapter.PencilAdapter;
import com.gisocn.onemap.ui.adapter.PhotoToolsAdapter;
import com.gisocn.onemap.ui.adapter.SearchAdapter;
import com.gisocn.onemap.ui.adapter.StatisticAdapter;
import com.gisocn.onemap.ui.adapter.ViewPagerAdapter;
import com.gisocn.onemap.ui.dialog.AboutSoftwareDialog;
import com.gisocn.onemap.ui.fragment.ChangePassWordFragment;
import com.gisocn.onemap.ui.fragment.CollectionFragment;
import com.gisocn.onemap.ui.fragment.FilePackageFragment;
import com.gisocn.onemap.ui.fragment.LayerManageFragment;
import com.gisocn.onemap.ui.fragment.OfflineDownloadMultiLevelFragment;
import com.gisocn.onemap.ui.fragment.PlanDataBaseFragment;
import com.gisocn.onemap.ui.fragment.QueryLocationFragment;
import com.gisocn.onemap.ui.fragment.QueryStatisticsDataFragment;
import com.gisocn.onemap.ui.popupwindow.DetailLandInfoPopWindow;
import com.gisocn.onemap.ui.popupwindow.DynamicDetailInfoPopWindow;
import com.gisocn.onemap.ui.popupwindow.LandInfoDetailPopWindow;
import com.gisocn.onemap.ui.popupwindow.LandInfoPopWindow;
import com.gisocn.onemap.ui.popupwindow.LandInfosPopWindow;
import com.gisocn.onemap.utils.AppVersionManager;
import com.gisocn.onemap.utils.ExecutorsManager;
import com.gisocn.onemap.utils.FileUtils;
import com.gisocn.onemap.utils.GCJ2WGSUtils;
import com.gisocn.onemap.utils.L;
import com.gisocn.onemap.utils.LogUtils;
import com.gisocn.onemap.utils.PackageUtils;
import com.gisocn.onemap.utils.SpUtils;
import com.gisocn.onemap.view.MainView;
import com.gisocn.onemap.widget.CustomMarkerView;
import com.gisocn.onemap.widget.MyViewPager;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.charts.PieChart;
import com.github.mikephil.charting.components.AxisBase;
import com.github.mikephil.charting.components.Description;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.PieData;
import com.github.mikephil.charting.data.PieDataSet;
import com.github.mikephil.charting.data.PieEntry;
import com.github.mikephil.charting.formatter.IAxisValueFormatter;
import com.github.mikephil.charting.formatter.PercentFormatter;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.Utils;
import com.google.android.material.badge.BadgeDrawable;
import com.google.android.material.timepicker.TimeModel;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.sangfor.ssl.common.Foreground;
import com.tencent.smtt.sdk.TbsListener;
import com.tencent.smtt.sdk.TbsReaderView;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

/* loaded from: classes.dex */
public class MainActivity extends BaseActivity<MainPresenter> implements MainView {
    public static String MEDIADATA_PATH;
    public static String MEDIADATA_PATH_REPLACE;
    PhotoToolsAdapter adapter;
    private AppConfig appConfig;
    private int asyncTaskIndex;
    @BindView(R.id.bar_chart)
    BarChart barChart;
    private ImageView bigImage;
    private TextView bigPhotoName;
    private TextView clear;
    private TextView close_Btn;
    private float curPosX;
    private float curPosY;
    int currentPosition;
    private DetailLandInfoPopWindow detailLandInfoPopWindow;
    private String displayField;
    DisplayMetrics dm;
    @BindView(R.id.doodle_view)
    public MyView doodleView;
    private DynamicDetailInfoPopWindow dynamicDetailInfoPopWindow;
    private View earthPopContentView;
    private PopupWindow earthPopupWindow;
    private File file;
    int flicker;
    private LocationListener gpsLocationListener;
    Graphic[] graphics;
    private int height;
    TextView image;
    CommonAdapter imgcSwitchAdapter;
    private View introducitonContentView;
    private PopupWindow introducitonPopupWindow;
    @BindView(R.id.iv_about)
    ImageView ivAbout;
    @BindView(R.id.iv_camera)
    ImageView ivCamera;
    @BindView(R.id.iv_chanage_password)
    ImageView ivChanagePassword;
    @BindView(R.id.iv_collection)
    ImageView ivCollection;
    @BindView(R.id.iv_compass)
    ImageView ivCompass;
    @BindView(R.id.iv_download)
    ImageView ivDownload;
    @BindView(R.id.iv_earth)
    ImageView ivEarth;
    @BindView(R.id.iv_eliminate)
    ImageView ivEliminate;
    @BindView(R.id.iv_finger)
    ImageView ivFinger;
    @BindView(R.id.iv_layer)
    ImageView ivLayer;
    @BindView(R.id.iv_legend)
    ImageView ivLegend;
    @BindView(R.id.iv_location)
    ImageView ivLocation;
    @BindView(R.id.iv_more)
    ImageView ivMore;
    @BindView(R.id.iv_package)
    ImageView ivPackage;
    @BindView(R.id.iv_pencil)
    ImageView ivPencil;
    @BindView(R.id.iv_plan)
    ImageView ivPlan;
    @BindView(R.id.iv_pointer)
    ImageView ivPointer;
    @BindView(R.id.iv_position)
    ImageView ivPosition;
    @BindView(R.id.iv_query)
    ImageView ivQuery;
    @BindView(R.id.iv_query_location)
    ImageView ivQueryLocation;
    @BindView(R.id.iv_rose)
    ImageView ivRose;
    @BindView(R.id.iv_ruler)
    ImageView ivRuler;
    @BindView(R.id.iv_search)
    ImageView ivSearch;
    @BindView(R.id.iv_whole)
    ImageView ivWhole;
    @BindView(R.id.iv_shrinkage_action)
    ImageView iv_shrinkage_action;
    private LandInfoDetailPopWindow landInfoDetailPopWindow;
    private LandInfoPopWindow landInfoPopWindow;
    private LandInfosPopWindow landInfosPopWindow;
    private double latitude;
    private String layerName;
    @BindView(R.id.leftTools_layout)
    RelativeLayout leftTools;
    @BindView(R.id.llBottom)
    LinearLayout llBottom;
    @BindView(R.id.ll_main_more)
    LinearLayout llMore;
    @BindView(R.id.ll_root)
    LinearLayout llRoot;
    @BindView(R.id.ll_statistic)
    LinearLayout llStatistic;
    @BindView(R.id.llTop)
    LinearLayout llTop;
    @BindView(R.id.ll_imgc)
    LinearLayout ll_imgc;
    @BindView(R.id.ll_imgc_recycle)
    LinearLayout ll_imgc_recycle;
    @BindView(R.id.ll_imgc_switch)
    RelativeLayout ll_imgc_switch;
    @BindView(R.id.ll_imgc_vec)
    LinearLayout ll_imgc_vec;
    @BindView(R.id.ll_ll_imgc_image)
    LinearLayout ll_ll_imgc_image;
    private LocationManager locationManager;
    private double longitude;
    private ImageReader mImageReader;
    private MediaProjection mMediaProjection;
    private VirtualDisplay mVirtualDisplay;
    @BindView(R.id.map)
    MapView map;
    @BindView(R.id.map_relayout)
    RelativeLayout mapLayout;
    private MediaProjectionManager mediaProjectionManager;
    public AMapLocationClient mlocationClient;
    private RelativeLayout.LayoutParams params;
    PencilAdapter pencilAdapter;
    private View pencilColorContentView;
    private PopupWindow pencilColorPopupWindow;
    private View pencilOpenContentView;
    private PopupWindow pencilOpenPopupWindow;
    private View pencilPopContentView;
    private PopupWindow pencilPopupWindow;
    private View pencilSaveContentView;
    private PopupWindow pencilSavePopupWindow;
    private View photoInfoPopContentView;
    private PopupWindow photoInfoPopupWindow;
    private ImageView photoLocation;
    private View photoPopContentView;
    private PopupWindow photoPopupWindow;
    private LinearLayout photoTools;
    private RecyclerView photorecyclerView;
    @BindView(R.id.pie_chart)
    PieChart pieChart;
    private PoiSearch poiSearch;
    private float posX;
    private float posX1;
    private float posY;
    private float posY1;
    private QueryXML queryXML;
    @BindView(R.id.recycle_statistic)
    RecyclerView recycleStatistic;
    @BindView(R.id.recycle_imgc)
    RecyclerView recycle_imgc;
    @BindView(R.id.rightTools_layout)
    LinearLayout rightTools;
    @BindView(R.id.rl_measure_angle)
    RelativeLayout rlMeasureAngle;
    private View rulerPopContentView;
    private PopupWindow rulerPopupWindow;
    private TextView savePathclose;
    private SearchAdapter searchAdapter;
    private View searchAdressContentView;
    private PopupWindow searchAdressPopWindow;
    private TextView searchClose_Btn;
    private View searchContentView;
    private EditText searchEditText;
    private View searchItemContentView;
    private PopupWindow searchItemPopuWindow;
    private PopupWindow searchPopupWindow;
    private TextView search_Btn;
    private SeekBar seekBar;
    private Dialog setIpDialog;
    private StatisticAdapter statisticAdapter;
    TextView test;
    Timer timer;
    @BindView(R.id.tv_bar)
    TextView tvBar;
    @BindView(R.id.tv_main_count)
    TextView tvCount;
    @BindView(R.id.tv_pie)
    TextView tvPie;
    @BindView(R.id.tv_static_close)
    TextView tvStaticClose;
    @BindView(R.id.tvStatisticArea)
    TextView tvStatisticArea;
    @BindView(R.id.tvStatisticYdxz)
    TextView tvStatisticYdxz;
    @BindView(R.id.tv_table)
    TextView tvTable;
    @BindView(R.id.tv_total_area)
    TextView tvTotalArea;
    @BindView(R.id.tv_total_count)
    TextView tvTotalCount;
    private TextView tv_data;
    @BindView(R.id.tv_imgc_image)
    TextView tv_imgc_image;
    @BindView(R.id.tv_imgc_name)
    TextView tv_imgc_name;
    @BindView(R.id.tv_imgc_vector)
    TextView tv_imgc_vector;
    TextView vector;
    @BindView(R.id.viewPager)
    MyViewPager viewPager;
    private int width;
    private String strDownloadOK = "0";
    private ArrayList<PencilInfo> pencilInfoArrayList = new ArrayList<>();
    private ArrayList<View> colors = new ArrayList<>();
    boolean onGps = true;
    private ArrayList<LandInfo> landInfos = new ArrayList<>();
    private ArrayList<VectorQuery> lists = new ArrayList<>();
    private int REQUEST_CAMERA = 101;
    private ArrayList<PhotoInfo> photoInfoArrayList = new ArrayList<>();
    private ArrayList<LayerQueryInfo> layerQueryInfos = new ArrayList<>();
    private ArrayList<PopupWindow> popupWindows = new ArrayList<>();
    private int onSingleListenerType = -1;
    private ArrayList<Point> measurePoints = new ArrayList<>();
    private int PK_UID = 0;
    private ArrayList<Statistic> statisticsList = new ArrayList<>();
    public AMapLocationClientOption mLocationOption = null;
    private Point markGeometry = null;
    private String photoUrl = "";
    private GraphicsLayer highLightLayer = null;
    private GraphicsLayer handPaintLayer = null;
    private GraphicsLayer graphicsLayer = new GraphicsLayer();
    String queryUrl = "";
    private ArrayList<DynamicLayerInfo> dynamicLayerInfoList = new ArrayList<>();
    private ArrayList<DynamicInfo> dynamicInfoList = new ArrayList<>();
    ArrayList<AsyncQueryTask> asyncQueryTasks = new ArrayList<>();
    boolean ishowTag = false;
    private ArrayList<PoiItem> searchList = new ArrayList<>();
    private ArrayList<PoiItem> adressList = new ArrayList<>();
    boolean isImageMap = false;
    private Timer mTimer = null;
    private TimerTask mTimerTask = null;
    boolean isOnClick = false;
    private ArrayList<ImgCLayer> imgcSwitchList = new ArrayList<>();
    private ArrayList<String> imgcSwitchListNames = new ArrayList<>();
    private boolean isShowVEC_C = true;
    private int imgcLoadOverIndex = 0;
    private ArrayList<LayerInfoBean> allLayers = new ArrayList<>();
    private ArrayList<String> baseMapNames = new ArrayList<>();
    private boolean imgcOpen = false;
    String nowViewClick = "iv_layer";
    private String CIA_C_Service = "";
    Handler handler = new Handler() { // from class: com.gisocn.onemap.ui.activity.MainActivity.25
        @Override // android.os.Handler
        public void handleMessage(Message message) {
            boolean z;
            boolean z2;
            super.handleMessage(message);
            int i = message.what;
            if (i == 1) {
                MainActivity.this.graphicsLayer.addGraphics(MainActivity.this.graphics);
                Log.e("layerName", message.getData().getString("layerName"));
                MainActivity.this.graphicsLayer.setName(message.getData().getString("layerName"));
                MainActivity.this.map.addLayer(MainActivity.this.graphicsLayer);
            } else if (i == 2) {
                if (MainActivity.this.lists.size() > 0) {
                    if (MainActivity.this.detailLandInfoPopWindow != null) {
                        MainActivity.this.detailLandInfoPopWindow.dismiss();
                    }
                    MainActivity mainActivity = MainActivity.this;
                    mainActivity.getLandInfo(mainActivity.lists);
                }
            } else if (i == 3) {
                MainActivity.this.viewPager.setVisibility(8);
                MainActivity.this.stopTimer();
            } else if (i == 5) {
                if (MainActivity.this.highLightLayer != null) {
                    MainActivity mainActivity2 = MainActivity.this;
                    if (mainActivity2.mapContains(mainActivity2.highLightLayer)) {
                        MainActivity.this.map.removeLayer(MainActivity.this.highLightLayer);
                    }
                    MainActivity.this.highLightLayer.removeAll();
                }
                MainActivity.this.highLightLayer = null;
            } else if (i == 1007) {
                MainActivity.this.graphicsLayer.addGraphic((Graphic) message.obj);
            } else if (i == 1111) {
                MainActivity.this.doodleView.setVisibility(0);
                try {
                    FileInputStream fileInputStream = new FileInputStream(((PencilInfo) message.obj).getPath());
                    MainActivity.this.doodleView.drawBitmapToCanvas(BitmapFactory.decodeStream(fileInputStream));
                    fileInputStream.close();
                    MainActivity.this.map.setExtent(((PencilInfo) message.obj).getPolygon(), 0);
                    MainActivity.this.map.setScale(((PencilInfo) message.obj).getScale());
                } catch (IOException e) {
                    e.printStackTrace();
                }
                MainActivity.this.pencilOpenPopupWindow.dismiss();
            } else if (i == 1000) {
                if (((ArrayList) message.getData().getSerializable("list")) != null) {
                    MainActivity.this.list.clear();
                    MainActivity.this.list.addAll((ArrayList) message.getData().getSerializable("list"));
                }
                ArrayList arrayList = new ArrayList();
                Iterator it = MainActivity.this.list.iterator();
                while (it.hasNext()) {
                    arrayList.addAll(((LayerQueryInfo) it.next()).getGeometries());
                }
                Iterator it2 = MainActivity.this.list.iterator();
                while (true) {
                    if (it2.hasNext()) {
                        if (((LayerQueryInfo) it2.next()).getList().size() > 1) {
                            z = false;
                            break;
                        }
                    } else {
                        z = true;
                        break;
                    }
                }
                Iterator it3 = MainActivity.this.dynamicInfoList.iterator();
                while (true) {
                    if (it3.hasNext()) {
                        if (((DynamicInfo) it3.next()).getGetGraphics().size() > 1) {
                            z2 = false;
                            break;
                        }
                    } else {
                        z2 = true;
                        break;
                    }
                }
                boolean z3 = z && z2 && MainActivity.this.list.size() + MainActivity.this.dynamicInfoList.size() == 1;
                MainActivity.this.singleGeometries.addAll(arrayList);
                if (!MainActivity.this.tpkQueryEnd || !MainActivity.this.dynamicQueryEnd) {
                    L.e("tpkQueryEnd:" + MainActivity.this.tpkQueryEnd + ";dynamicQueryEnd:" + MainActivity.this.dynamicQueryEnd);
                } else if (z3) {
                    if (MainActivity.this.list.size() != 1) {
                        if (MainActivity.this.dynamicInfoList.size() == 1) {
                            if (MainActivity.this.highLightLayer != null) {
                                MainActivity.this.highLightLayer.removeAll();
                            }
                            ArrayList arrayList2 = new ArrayList();
                            for (Field field : ((DynamicInfo) MainActivity.this.dynamicInfoList.get(0)).getFields()) {
                                DynamicInfo.DetaileInfo detaileInfo = new DynamicInfo.DetaileInfo();
                                detaileInfo.setKey("" + field.getAlias());
                                detaileInfo.setRealKey("" + field.getName());
                                detaileInfo.setValue("" + ((DynamicInfo) MainActivity.this.dynamicInfoList.get(0)).getGetGraphics().get(0).getAttributeValue(field.getName()));
                                detaileInfo.setStrType(field.getFieldType());
                                arrayList2.add(detaileInfo);
                            }
                            MapView mapView = MainActivity.this.map;
                            Geometry geometry = ((DynamicInfo) MainActivity.this.dynamicInfoList.get(0)).getGetGraphics().get(0).getGeometry();
                            double d = ((MainActivity.this.dm.widthPixels - 70) / 3) - 100;
                            Double.isNaN(d);
                            mapView.setExtent(geometry, (int) (d * 1.5d));
                            MainActivity.this.map.zoomin();
                            MainActivity.this.map.zoomin();
                            MainActivity.this.map.zoomin();
                            MainActivity.this.map.zoomin();
                            MainActivity mainActivity3 = MainActivity.this;
                            mainActivity3.loadGeometry(((DynamicInfo) mainActivity3.dynamicInfoList.get(0)).getGetGraphics().get(0).getGeometry(), "", 2);
                            MainActivity mainActivity4 = MainActivity.this;
                            mainActivity4.dynamicDetailInfoPopWindow(arrayList2, null, ((DynamicInfo) mainActivity4.dynamicInfoList.get(0)).getLayerName(), ((DynamicInfo) MainActivity.this.dynamicInfoList.get(0)).getDisplayFieldName().get(0));
                            return;
                        }
                        return;
                    }
                    String str = Constant.SAVE_PATH + "shp/" + ((LayerQueryInfo) MainActivity.this.list.get(0)).getXmlName();
                    Log.e("PK_UID:", "" + ((LayerQueryInfo) MainActivity.this.list.get(0)).getList().get(0).get("PK_UID"));
                    MainActivity mainActivity5 = MainActivity.this;
                    mainActivity5.PK_UID = Integer.parseInt(((LayerQueryInfo) mainActivity5.list.get(0)).getList().get(0).get("PK_UID").getAsString());
                    MainActivity mainActivity6 = MainActivity.this;
                    mainActivity6.layerName = ((LayerQueryInfo) mainActivity6.list.get(0)).getLayerName();
                    if (((LayerQueryInfo) MainActivity.this.list.get(0)).getList().get(0).get("displayField") != null) {
                        String asString = ((LayerQueryInfo) MainActivity.this.list.get(0)).getList().get(0).get("displayField").getAsString();
                        if (((LayerQueryInfo) MainActivity.this.list.get(0)).getList().get(0).get(asString.toUpperCase()) != null) {
                            MainActivity mainActivity7 = MainActivity.this;
                            mainActivity7.displayField = ((LayerQueryInfo) mainActivity7.list.get(0)).getList().get(0).get(asString.toUpperCase()).getAsString();
                        } else {
                            MainActivity mainActivity8 = MainActivity.this;
                            mainActivity8.displayField = ((LayerQueryInfo) mainActivity8.list.get(0)).getList().get(0).get(asString).getAsString();
                        }
                    }
                    ((MainPresenter) MainActivity.this.presenter).getXmlInfo(str, 0, 0);
                } else {
                    MainActivity mainActivity9 = MainActivity.this;
                    mainActivity9.getLandInfos(mainActivity9.list, MainActivity.this.dynamicInfoList);
                }
            } else {
                if (i != 1001) {
                    return;
                }
                MainActivity mainActivity10 = MainActivity.this;
                mainActivity10.detailLandInfoPopWindow(mainActivity10.landInfos, ((LayerQueryInfo) MainActivity.this.layerQueryInfos.get(message.arg1)).getGeometries().get(message.arg2), MainActivity.this.layerName, MainActivity.this.displayField, message.getData().getString("db"), String.valueOf(message.getData().getInt("id")));
                double d2 = ((MainActivity.this.dm.widthPixels - 70) / 3) - 100;
                Double.isNaN(d2);
                MainActivity.this.map.setExtent(((LayerQueryInfo) MainActivity.this.layerQueryInfos.get(message.arg1)).getGeometries().get(message.arg2), (int) (d2 * 1.5d));
                MainActivity.this.map.zoomin();
                MainActivity.this.map.zoomin();
                MainActivity.this.map.zoomin();
                MainActivity.this.map.zoomin();
                MainActivity mainActivity11 = MainActivity.this;
                mainActivity11.loadGeometry(((LayerQueryInfo) mainActivity11.layerQueryInfos.get(message.arg1)).getGeometries().get(message.arg2), "", 2);
            }
        }
    };
    boolean openLocation = false;
    boolean loaclIsOff = false;
    Symbol symbol = new SimpleFillSymbol((int) R.color.colorGray);
    double distanceSum = Utils.DOUBLE_EPSILON;
    private long exitTime = 0;
    private ArrayList<LayerQueryInfo> list = new ArrayList<>();
    private ArrayList<Geometry> singleGeometries = new ArrayList<>();
    private boolean tpkQueryEnd = false;
    private boolean dynamicQueryEnd = false;
    ArrayList<ArcGISLayerInfo> layerInfoList = new ArrayList<>();
    ArrayList<LayerInfoBean> layerList = new ArrayList<>();
    boolean isStart = false;
    private ArrayList<String> queryUrls = new ArrayList<>();

    @Override // com.gisocn.onemap.view.MainView
    public void getAppVersionFail(String str) {
    }

    static /* synthetic */ int access$2708(MainActivity mainActivity) {
        int i = mainActivity.imgcLoadOverIndex;
        mainActivity.imgcLoadOverIndex = i + 1;
        return i;
    }

    static /* synthetic */ int access$608(MainActivity mainActivity) {
        int i = mainActivity.asyncTaskIndex;
        mainActivity.asyncTaskIndex = i + 1;
        return i;
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // com.gisocn.onemap.base.BaseActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, androidx.core.app.ComponentActivity, android.app.Activity
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        EventBus.getDefault().register(this);
        DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
        this.dm = displayMetrics;
        this.width = displayMetrics.widthPixels;
        this.height = this.dm.heightPixels;
        AppConfig appConfig = (AppConfig) new Gson().fromJson(getIntent().getStringExtra("appConfig"), (Class<Object>) AppConfig.class);
        this.appConfig = appConfig;
        Constant.WKID = Integer.parseInt(appConfig.getShapeFileWkid().trim());
        L.e(Constant.WKID + "坐标系");
        if (this.appConfig.getMediaData() != null) {
            String trim = this.appConfig.getMediaData().getUrl().trim();
            L.e("MEDIADATA_PATH_RE" + trim);
            String[] split = trim.split("/");
            String str = "/" + split[split.length - 1];
            MEDIADATA_PATH_REPLACE = str;
            MEDIADATA_PATH = trim.replace(str, "");
            L.e("MEDIADATA_PATH_RE" + MEDIADATA_PATH_REPLACE);
            L.e("MEDIADATA_PATH" + MEDIADATA_PATH);
        }
        L.e(" Constant.WKID" + Constant.WKID);
        ((MainPresenter) this.presenter).getAppConfigData(this.appConfig);
        this.imgcSwitchList.clear();
        init();
        this.viewPager.setVisibility(0);
        initImageBg();
        if (getPackageName().equals(BuildConfig.APPLICATION_ID)) {
            this.params.width = ((this.width - 70) / 5) + 20;
        } else {
            this.params.width = (this.width - 70) / 3;
        }
        this.llMore.setVisibility(8);
        this.ivLayer.setImageResource(R.mipmap.icon_layer_on);
        this.viewPager.setCurrentItem(0, false);
        new Thread(new MyRunnable()).start();
    }

    /* loaded from: classes2.dex */
    public class MyRunnable implements Runnable {
        public MyRunnable() {
        }

        @Override // java.lang.Runnable
        public void run() {
            MainActivity.this.unShapeZip();
        }
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // com.gisocn.onemap.base.BaseActivity
    public MainPresenter createPresenter() {
        return new MainPresenter(this, this);
    }

    public void starTimer() {
        L.e("--------------starTimer----------");
        stopTimer();
        if (this.mTimer == null) {
            this.mTimer = new Timer();
        }
        if (this.mTimerTask == null) {
            this.mTimerTask = new TimerTask() { // from class: com.gisocn.onemap.ui.activity.MainActivity.1
                @Override // java.util.TimerTask, java.lang.Runnable
                public void run() {
                    Message message = new Message();
                    message.what = 3;
                    MainActivity.this.handler.sendMessage(message);
                }
            };
        }
        this.mTimer.schedule(this.mTimerTask, 3000L);
    }

    public void stopTimer() {
        L.e("--------------stopTimer----------");
        Timer timer = this.mTimer;
        if (timer != null) {
            timer.cancel();
            this.mTimer = null;
        }
        TimerTask timerTask = this.mTimerTask;
        if (timerTask != null) {
            timerTask.cancel();
            this.mTimerTask = null;
        }
    }

    public void unShapeZip() {
        String[] list;
        File file = new File(Constant.SAVE_PATH_SHP);
        if (file.length() > 0) {
            for (String str : file.list()) {
                if (!str.contains(".temp") && str.contains(".zip")) {
                    unZipFile(Constant.SAVE_PATH_SHP + str, Constant.SAVE_PATH_SHP);
                }
            }
        }
    }

    public void unZipFile(String str, String str2) {
        if (new File(str).exists()) {
            try {
                if (Build.VERSION.SDK_INT >= 24) {
                    ZipFile zipFile = new ZipFile(str, Charset.forName("GBK"));
                    Enumeration<? extends ZipEntry> entries = zipFile.entries();
                    while (entries.hasMoreElements()) {
                        ZipEntry nextElement = entries.nextElement();
                        String name = nextElement.getName();
                        File file = new File(new File(str2 + name).getParent());
                        if (!file.exists()) {
                            file.mkdirs();
                        }
                        BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(str2 + "/" + name));
                        BufferedInputStream bufferedInputStream = new BufferedInputStream(zipFile.getInputStream(nextElement));
                        byte[] bArr = new byte[4096];
                        for (int read = bufferedInputStream.read(bArr); read != -1; read = bufferedInputStream.read(bArr)) {
                            bufferedOutputStream.write(bArr, 0, read);
                        }
                        bufferedOutputStream.close();
                    }
                    zipFile.close();
                    L.e("解压完成" + str);
                    deleteDir(new File(str));
                }
            } catch (FileNotFoundException e) {
                L.e(e.getMessage());
            } catch (IOException e2) {
                L.e(e2.getMessage());
                L.e("解压失败");
            }
        }
    }

    public void deleteDir(File file) {
        if (file.exists()) {
            if (file.isDirectory()) {
                File[] listFiles = file.listFiles();
                if (listFiles == null || listFiles.length == 0) {
                    file.delete();
                }
                for (File file2 : listFiles) {
                    deleteDir(file2);
                }
            }
            file.delete();
        }
    }

    private void init() {
        this.rightTools.setVisibility(0);
        this.ivCollection.setVisibility(0);
        this.ivPlan.setVisibility(8);
        this.ivCamera.setVisibility(0);
        this.ivFinger.setVisibility(8);
        this.ivChanagePassword.setVisibility(0);
        this.ivQuery.setVisibility(0);
        this.ivDownload.setVisibility(0);
        this.strDownloadOK = "0";
        this.ivPackage.setVisibility(0);
        this.ivLocation.setVisibility(0);
        this.mapLayout.setOnTouchListener(new View.OnTouchListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.2
            @Override // android.view.View.OnTouchListener
            public boolean onTouch(View view, MotionEvent motionEvent) {
                if (MainActivity.this.isOnClick) {
                    return false;
                }
                MainActivity.this.starTimer();
                MainActivity.this.isOnClick = true;
                return false;
            }
        });
        if (ActivityCompat.checkSelfPermission(this, "android.permission.ACCESS_FINE_LOCATION") != 0) {
            ActivityCompat.requestPermissions(this, new String[]{"android.permission.ACCESS_FINE_LOCATION"}, 101);
        }
        ArcGISRuntime.setClientId(Constant.ARC_GIS_MAP_KEY);
        this.map.setMapBackground(16777215, 16777215, 1.0f, 100.0f);
        this.map.setOnSingleTapListener(new OnSingleTapListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.3
            @Override // com.esri.android.map.event.OnSingleTapListener
            public void onSingleTap(float f, float f2) {
                L.e("" + MainActivity.this.map.isLoaded());
                if (MainActivity.this.map.isLoaded()) {
                    if (MainActivity.this.onSingleListenerType != -1) {
                        if (MainActivity.this.onSingleListenerType == 0) {
                            MainActivity.this.measureDistance(f, f2);
                            return;
                        } else if (MainActivity.this.onSingleListenerType == 1) {
                            MainActivity.this.measureArea(f, f2);
                            return;
                        } else {
                            return;
                        }
                    }
                    MainActivity.this.singleQuery(f, f2);
                    return;
                }
                MainActivity.this.showToast("未加载地图");
            }
        });
        this.map.setOnZoomListener(new OnZoomListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.4
            @Override // com.esri.android.map.event.OnZoomListener
            public void preAction(float f, float f2, double d) {
                L.e("preAction" + f + "|" + f2 + "|" + d);
            }

            @Override // com.esri.android.map.event.OnZoomListener
            public void postAction(float f, float f2, double d) {
                Layer[] layers;
                if (MainActivity.this.getPackageName().equals(BuildConfig.APPLICATION_ID)) {
                    L.e("postAction" + f + "|" + f2 + "|" + d + "---" + MainActivity.this.map.getScale());
                    if (MainActivity.this.isImageMap) {
                        return;
                    }
                    boolean z = MainActivity.this.map.getScale() <= TDTConstant.SCALES[16];
                    if (!z) {
                        MainActivity.this.imgcOpen = false;
                    }
                    for (Layer layer : MainActivity.this.map.getLayers()) {
                        String str = "";
                        if ("VEC_C".equals(layer.getName())) {
                            layer.setVisible(!z);
                            MainActivity.this.ll_ll_imgc_image.setVisibility(z ? 0 : 8);
                            MainActivity.this.ll_imgc_vec.setVisibility(!z ? 0 : 8);
                            MainActivity.this.ll_imgc_recycle.setVisibility(MainActivity.this.imgcOpen ? 0 : 8);
                            MainActivity.this.ll_imgc_switch.setVisibility(z ? 0 : 8);
                            Glide.with((FragmentActivity) MainActivity.this).load(Integer.valueOf(MainActivity.this.imgcOpen ? R.mipmap.ic_imgc_open : R.mipmap.ic_imgc_close)).into(MainActivity.this.iv_shrinkage_action);
                            Iterator it = MainActivity.this.imgcSwitchList.iterator();
                            while (it.hasNext()) {
                                ImgCLayer imgCLayer = (ImgCLayer) it.next();
                                if (imgCLayer.isCheck()) {
                                    str = imgCLayer.getLayer().getName();
                                }
                            }
                            MainActivity.this.tv_imgc_name.setText(str);
                        } else if (!"IMG_C".equals(layer.getName()) && !"CIA_C".equals(layer.getName())) {
                            if (MainActivity.this.imgcSwitchListNames.contains(layer.getName())) {
                                Iterator it2 = MainActivity.this.imgcSwitchList.iterator();
                                while (true) {
                                    if (!it2.hasNext()) {
                                        break;
                                    }
                                    ImgCLayer imgCLayer2 = (ImgCLayer) it2.next();
                                    if (imgCLayer2.isCheck()) {
                                        str = imgCLayer2.getLayer().getName();
                                        break;
                                    }
                                }
                                if (str.equals(layer.getName())) {
                                    layer.setVisible(z);
                                    MainActivity.this.ll_ll_imgc_image.setVisibility(z ? 0 : 8);
                                    MainActivity.this.ll_imgc_vec.setVisibility(z ? 8 : 0);
                                }
                            }
                        } else {
                            layer.setVisible(z);
                            MainActivity.this.ll_ll_imgc_image.setVisibility(z ? 0 : 8);
                            MainActivity.this.ll_imgc_vec.setVisibility(z ? 8 : 0);
                        }
                    }
                    if (MainActivity.this.vector == null || MainActivity.this.image == null) {
                        return;
                    }
                    TextView textView = MainActivity.this.vector;
                    MainActivity mainActivity = MainActivity.this;
                    textView.setBackgroundColor(!z ? ContextCompat.getColor(mainActivity, R.color.colorPrimary) : ContextCompat.getColor(mainActivity, R.color.colorGray));
                    MainActivity.this.image.setBackgroundColor(z ? ContextCompat.getColor(MainActivity.this, R.color.colorPrimary) : ContextCompat.getColor(MainActivity.this, R.color.colorGray));
                }
            }
        });
        this.statisticAdapter = new StatisticAdapter(this.statisticsList);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        linearLayoutManager.setOrientation(1);
        this.recycleStatistic.setLayoutManager(linearLayoutManager);
        this.recycleStatistic.setAdapter(this.statisticAdapter);
        LinearLayoutManager linearLayoutManager2 = new LinearLayoutManager(this);
        linearLayoutManager2.setOrientation(1);
        this.recycle_imgc.setLayoutManager(linearLayoutManager2);
        CommonAdapter<ImgCLayer> commonAdapter = new CommonAdapter<ImgCLayer>(this, R.layout.item_imgc_switch, this.imgcSwitchList) { // from class: com.gisocn.onemap.ui.activity.MainActivity.5
            /* JADX INFO: Access modifiers changed from: protected */
            @Override // com.gisocn.onemap.base.CommonAdapter
            public void convert(ViewHolder viewHolder, ImgCLayer imgCLayer, int i) {
                viewHolder.setText(R.id.tv_name, imgCLayer.getLayer().getName());
                viewHolder.setVisible(R.id.iv_check, imgCLayer.isCheck());
            }
        };
        this.imgcSwitchAdapter = commonAdapter;
        commonAdapter.setOnItemClickListener(new MultiItemTypeAdapter.OnItemClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.6
            @Override // com.gisocn.onemap.base.MultiItemTypeAdapter.OnItemClickListener
            public boolean onItemLongClick(View view, RecyclerView.ViewHolder viewHolder, int i) {
                return false;
            }

            @Override // com.gisocn.onemap.base.MultiItemTypeAdapter.OnItemClickListener
            public void onItemClick(View view, RecyclerView.ViewHolder viewHolder, int i) {
                Layer[] layers;
                MainActivity.this.tv_imgc_name.setText(((ImgCLayer) MainActivity.this.imgcSwitchList.get(i)).getLayer().getName() + "");
                Iterator it = MainActivity.this.imgcSwitchList.iterator();
                while (it.hasNext()) {
                    ((ImgCLayer) it.next()).setCheck(false);
                }
                ((ImgCLayer) MainActivity.this.imgcSwitchList.get(i)).setCheck(!((ImgCLayer) MainActivity.this.imgcSwitchList.get(i)).isCheck());
                MainActivity.this.imgcSwitchAdapter.notifyDataSetChanged();
                for (Layer layer : MainActivity.this.map.getLayers()) {
                    L.e("底图图层" + layer.getName());
                    if ("VEC_C".equals(layer.getName())) {
                        layer.setVisible(false);
                    } else if (!"IMG_C".equals(layer.getName()) && !"CIA_C".equals(layer.getName())) {
                        if (MainActivity.this.imgcSwitchListNames.contains(layer.getName())) {
                            L.e("layer.isInitialized()__11" + layer.getName() + "----------" + layer.isInitialized());
                            L.e("layer.isInitialized()__12" + layer.getName() + "----------" + layer.isInitialized());
                            if (layer.getName().equals(((ImgCLayer) MainActivity.this.imgcSwitchList.get(i)).getLayer().getName())) {
                                layer.setVisible(true);
                            } else {
                                layer.setVisible(false);
                            }
                        }
                    } else {
                        layer.setVisible(true);
                    }
                }
            }
        });
        this.recycle_imgc.setAdapter(this.imgcSwitchAdapter);
        Glide.with((FragmentActivity) this).load(this.appConfig.getWindrose()).into(this.ivRose);
        initFragment();
        this.imgcSwitchList.clear();
        this.imgcLoadOverIndex = 0;
        initBaseMapSG(0, false);
        L.e("imgcSwitchList.size()" + this.imgcSwitchList.size());
        this.imgcSwitchAdapter.notifyDataSetChanged();
        initPermission();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes2.dex */
    public class AsyncQueryTask extends AsyncTask<Float, Void, FeatureSet> {
        String groupName;
        String name;
        String url;

        AsyncQueryTask(String str, String str2, String str3) {
            this.url = str;
            this.name = str2;
            this.groupName = str3;
        }

        /* JADX INFO: Access modifiers changed from: protected */
        @Override // android.os.AsyncTask
        public FeatureSet doInBackground(Float... fArr) {
            Envelope envelope = new Envelope(MainActivity.this.map.toMapPoint(fArr[0].floatValue(), fArr[1].floatValue()), MainActivity.this.map.getResolution() * 10.0d, 10.0d * MainActivity.this.map.getResolution());
            if (MainActivity.this.isNull(this.url)) {
                return null;
            }
            QueryTask queryTask = new QueryTask(this.url);
            Query query = new Query();
            query.setGeometry(envelope);
            query.setReturnGeometry(true);
            query.setOutFields(new String[]{"*"});
            Log.e("getOutFields", "" + new Gson().toJson(query.getOutFields()));
            try {
                return queryTask.execute(query);
            } catch (Exception e) {
                e.printStackTrace();
                return null;
            }
        }

        /* JADX INFO: Access modifiers changed from: protected */
        @Override // android.os.AsyncTask
        public void onPostExecute(FeatureSet featureSet) {
            StringBuilder sb;
            String alias;
            String str;
            String str2;
            MainActivity.access$608(MainActivity.this);
            L.e("onPostExecute_url" + this.url);
            if (featureSet != null && featureSet.getGraphics() != null && featureSet.getFields() != null && featureSet.getGraphics().length > 0) {
                Iterator<Field> it = featureSet.getFields().iterator();
                while (true) {
                    if (!it.hasNext()) {
                        str = "";
                        str2 = str;
                        break;
                    }
                    Field next = it.next();
                    if (next.getName().equals(featureSet.getDisplayFieldName())) {
                        str = next.getName();
                        str2 = next.getAlias();
                        break;
                    }
                }
                ArrayList arrayList = MainActivity.this.dynamicLayerInfoList;
                String str3 = this.groupName;
                String str4 = this.name;
                arrayList.add(new DynamicLayerInfo(str3, str4, str2, str + "", featureSet.getFields(), Arrays.asList(featureSet.getGraphics())));
            }
            if (MainActivity.this.asyncTaskIndex >= MainActivity.this.asyncQueryTasks.size()) {
                ArrayList arrayList2 = new ArrayList();
                MainActivity.this.dynamicQueryEnd = true;
                Iterator it2 = MainActivity.this.dynamicLayerInfoList.iterator();
                while (it2.hasNext()) {
                    DynamicLayerInfo dynamicLayerInfo = (DynamicLayerInfo) it2.next();
                    DynamicInfo dynamicInfo = new DynamicInfo();
                    dynamicInfo.setLayerName(dynamicLayerInfo.getLayerName());
                    dynamicInfo.setGroupName(dynamicLayerInfo.getGroupName());
                    dynamicInfo.setDisplayField(dynamicLayerInfo.getDisplayField());
                    ArrayList<String> arrayList3 = new ArrayList<>();
                    ArrayList arrayList4 = new ArrayList();
                    for (Graphic graphic : dynamicLayerInfo.getGetGraphics()) {
                        DynamicInfo.DetaileInfoList detaileInfoList = new DynamicInfo.DetaileInfoList();
                        arrayList2.add(graphic.getGeometry());
                        arrayList3.add(graphic.getAttributeValue(dynamicLayerInfo.getDisplayFieldName()) + "");
                        ArrayList<DynamicInfo.DetaileInfo> arrayList5 = new ArrayList<>();
                        for (Field field : dynamicLayerInfo.getFields()) {
                            DynamicInfo.DetaileInfo detaileInfo = new DynamicInfo.DetaileInfo();
                            StringBuilder sb2 = new StringBuilder();
                            Iterator it3 = it2;
                            sb2.append("zxhhh975--> ");
                            sb2.append(field.getAlias());
                            sb2.append(" , ");
                            sb2.append(field.getName());
                            LogUtils.i(sb2.toString());
                            detaileInfo.setKey("" + field.getAlias());
                            detaileInfo.setRealKey("" + field.getName());
                            if (graphic.getAttributeValue(field.getName()) != null) {
                                sb = new StringBuilder();
                                alias = field.getName();
                            } else {
                                sb = new StringBuilder();
                                alias = field.getAlias();
                            }
                            sb.append(graphic.getAttributeValue(alias));
                            sb.append("");
                            detaileInfo.setValue(sb.toString());
                            detaileInfo.setStrType(field.getFieldType());
                            if (!arrayList5.contains(detaileInfo)) {
                                arrayList5.add(detaileInfo);
                            }
                            it2 = it3;
                        }
                        detaileInfoList.setDetaileInfos(arrayList5);
                        arrayList4.add(detaileInfoList);
                    }
                    Iterator it4 = it2;
                    dynamicInfo.setDisplayFieldName(arrayList3);
                    dynamicInfo.setGetGraphics(dynamicLayerInfo.getGetGraphics());
                    dynamicInfo.setDetaileInfo(arrayList4);
                    dynamicInfo.setFields(dynamicLayerInfo.getFields());
                    L.e("dynamicInfo____________________" + new Gson().toJson(dynamicInfo));
                    if (!MainActivity.this.dynamicInfoList.contains(dynamicInfo)) {
                        MainActivity.this.dynamicInfoList.add(dynamicInfo);
                    }
                    it2 = it4;
                }
                MainActivity.this.singleGeometries.addAll(arrayList2);
                MainActivity.this.handler.sendEmptyMessage(1000);
                MainActivity.this.dismissProgressDialog();
                L.e("dynamicInfoList____________________geometries" + arrayList2.size());
                L.e("dynamicInfoList____________________geometries" + arrayList2.size());
            }
        }
    }

    /* loaded from: classes2.dex */
    class AsyncQueryTaskFeatureResult extends AsyncTask<Float, Void, FeatureResult> {
        AsyncQueryTaskFeatureResult() {
        }

        /* JADX INFO: Access modifiers changed from: protected */
        @Override // android.os.AsyncTask
        public FeatureResult doInBackground(Float... fArr) {
            Envelope envelope = new Envelope(MainActivity.this.map.toMapPoint(fArr[0].floatValue(), fArr[1].floatValue()), MainActivity.this.map.getResolution() * 5.0d, 5.0d * MainActivity.this.map.getResolution());
            MainActivity.this.map.toMapPoint(fArr[0].floatValue(), fArr[1].floatValue());
            com.esri.core.tasks.query.QueryTask queryTask = new com.esri.core.tasks.query.QueryTask("http://192.168.0.55:6080/arcgis/rest/services/ZS/JCYJCSZT/MapServer/0");
            QueryParameters queryParameters = new QueryParameters();
            SpatialReference create = SpatialReference.create(3857);
            queryParameters.setGeometry(envelope);
            queryParameters.setOutSpatialReference(create);
            queryParameters.setReturnGeometry(true);
            try {
                return queryTask.execute(queryParameters);
            } catch (Exception e) {
                e.printStackTrace();
                return null;
            }
        }

        /* JADX INFO: Access modifiers changed from: protected */
        @Override // android.os.AsyncTask
        public void onPostExecute(FeatureResult featureResult) {
            if (featureResult != null) {
                L.e("onPostExecute_!= null" + featureResult.getFields().size());
                Log.e("\"onPostExecute_!= null", "" + new Gson().toJson(featureResult.getFields()));
                Iterator<Object> it = featureResult.iterator();
                if (it.hasNext()) {
                    Feature feature = (Feature) it.next();
                    Map<String, Object> attributes = feature.getAttributes();
                    feature.getSymbol();
                    feature.getGeometry();
                    L.e("Feature" + new Gson().toJson(attributes));
                    return;
                }
                return;
            }
            L.e("onPostExecute____null" + new Gson().toJson(featureResult));
        }
    }

    private void initFragment() {
        ArrayList arrayList = new ArrayList();
        this.viewPager.setScrollble(false);
        this.params = (RelativeLayout.LayoutParams) this.viewPager.getLayoutParams();
        arrayList.add(new LayerManageFragment());
        arrayList.add(new QueryStatisticsDataFragment());
        arrayList.add(new PlanDataBaseFragment());
        arrayList.add(new FilePackageFragment());
        arrayList.add(new OfflineDownloadMultiLevelFragment());
        arrayList.add(new CollectionFragment());
        arrayList.add(new ChangePassWordFragment());
        arrayList.add(new QueryLocationFragment());
        this.viewPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(), arrayList));
        this.viewPager.setOffscreenPageLimit(arrayList.size());
        this.viewPager.setCurrentItem(0, false);
        this.viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.7
            @Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
            public void onPageScrollStateChanged(int i) {
            }

            @Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
            public void onPageScrolled(int i, float f, int i2) {
            }

            @Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
            public void onPageSelected(int i) {
                if (i != 1) {
                    return;
                }
                EventBus.getDefault().post(new MessageEvent(Constant.MESSAGE_EVENT_QUERY_LAWYER_OPEN));
            }
        });
        this.viewPager.setOnTouchListener(new View.OnTouchListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.8
            @Override // android.view.View.OnTouchListener
            public boolean onTouch(View view, MotionEvent motionEvent) {
                L.e("滑动setOnTouchListener");
                int action = motionEvent.getAction();
                if (action == 0) {
                    MainActivity.this.posX1 = motionEvent.getX();
                    MainActivity.this.posY1 = motionEvent.getY();
                } else if (action != 1) {
                    if (action == 2) {
                        MainActivity.this.curPosX = motionEvent.getX();
                        MainActivity.this.curPosY = motionEvent.getY();
                    }
                } else if (MainActivity.this.curPosX - MainActivity.this.posX1 <= 0.0f || Math.abs(MainActivity.this.curPosX - MainActivity.this.posX1) <= 25.0f) {
                    if (MainActivity.this.curPosX - MainActivity.this.posX1 < 0.0f && Math.abs(MainActivity.this.curPosX - MainActivity.this.posX1) > 25.0f) {
                        L.e("向右滑动");
                    }
                } else {
                    L.e("向左滑动");
                }
                return true;
            }
        });
    }

    @OnClick({R.id.iv_layer, R.id.iv_query, R.id.iv_plan, R.id.iv_package, R.id.iv_download, R.id.iv_collection, R.id.iv_more, R.id.iv_rose, R.id.iv_finger, R.id.iv_about, R.id.iv_whole, R.id.iv_location, R.id.iv_earth, R.id.iv_pencil, R.id.iv_ruler, R.id.iv_camera, R.id.iv_eliminate, R.id.tv_static_close, R.id.tv_pie, R.id.tv_bar, R.id.iv_chanage_password, R.id.iv_search, R.id.ll_imgc_vec, R.id.ll_imgc_bottom, R.id.ll_ll_imgc_image, R.id.iv_query_location})
    public void onViewClicked(View view) {
        this.doodleView.removeAllPaint();
        int i = 0;
        if (view.getId() == R.id.iv_package) {
            this.viewPager.setVisibility(8);
            this.params.width = this.width;
            this.viewPager.setLayoutParams(this.params);
            if (this.rightTools.getVisibility() == 0) {
                this.rightTools.setVisibility(8);
            }
        } else if (view.getId() == R.id.iv_layer || view.getId() == R.id.iv_query || view.getId() == R.id.iv_plan || view.getId() == R.id.iv_download || view.getId() == R.id.iv_collection || view.getId() == R.id.iv_query_location) {
            if (getPackageName().equals(BuildConfig.APPLICATION_ID)) {
                this.params.width = (this.width - 70) / 4;
            } else {
                this.params.width = (this.width - 70) / 3;
            }
            this.viewPager.setLayoutParams(this.params);
            if (this.rightTools.getVisibility() == 8) {
                this.rightTools.setVisibility(0);
            }
        }
        if (view.getId() != R.id.iv_layer) {
            DetailLandInfoPopWindow detailLandInfoPopWindow = this.detailLandInfoPopWindow;
            if (detailLandInfoPopWindow != null) {
                detailLandInfoPopWindow.dismiss();
            }
            LandInfoPopWindow landInfoPopWindow = this.landInfoPopWindow;
            if (landInfoPopWindow != null) {
                landInfoPopWindow.dismiss();
            }
        }
        switch (view.getId()) {
            case R.id.iv_about /* 2131230963 */:
                this.ivFinger.setImageResource(R.mipmap.icon_finger_off);
                this.ivAbout.setImageResource(R.mipmap.icon_about_on);
                showAboutSoftDialog(this.appConfig.getAboutSoftware(), this.appConfig.getVersionLog());
                return;
            case R.id.iv_camera /* 2131230966 */:
                switchCameraWindow(this.ivCamera);
                return;
            case R.id.iv_chanage_password /* 2131230967 */:
                this.llMore.setVisibility(8);
                this.viewPager.setVisibility(0);
                this.viewPager.setCurrentItem(6, false);
                return;
            case R.id.iv_collection /* 2131230970 */:
                stopTimer();
                initImageBg();
                this.llMore.setVisibility(8);
                this.ivCollection.setImageResource(R.mipmap.icon_collection_on);
                this.viewPager.setCurrentItem(5, false);
                if (this.nowViewClick.equals("iv_collection")) {
                    MyViewPager myViewPager = this.viewPager;
                    myViewPager.setVisibility(myViewPager.getVisibility() != 0 ? 0 : 8);
                } else {
                    this.viewPager.setVisibility(0);
                }
                this.nowViewClick = "iv_collection";
                return;
            case R.id.iv_download /* 2131230974 */:
                if ("1".equals(this.strDownloadOK)) {
                    stopTimer();
                    initImageBg();
                    this.llMore.setVisibility(8);
                    this.ivDownload.setImageResource(R.mipmap.icon_download_on);
                    this.viewPager.setCurrentItem(4, false);
                    if (this.nowViewClick.equals("iv_download")) {
                        MyViewPager myViewPager2 = this.viewPager;
                        myViewPager2.setVisibility(myViewPager2.getVisibility() != 0 ? 0 : 8);
                    } else {
                        this.viewPager.setVisibility(0);
                    }
                    this.nowViewClick = "iv_download";
                    return;
                }
                AlertDialog.Builder builder = new AlertDialog.Builder(this);
                builder.setTitle("提示：");
                builder.setMessage("离线下载的目录尚未加载完成，请稍后再试！");
                builder.setIcon(R.mipmap.icon_logo);
                builder.setCancelable(true);
                builder.setPositiveButton("确定", new DialogInterface.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.9
                    @Override // android.content.DialogInterface.OnClickListener
                    public void onClick(DialogInterface dialogInterface, int i2) {
                        dialogInterface.dismiss();
                    }
                });
                builder.create().show();
                return;
            case R.id.iv_eliminate /* 2131230977 */:
                Timer timer = this.timer;
                if (timer != null) {
                    this.flicker = 6;
                    timer.cancel();
                }
                while (i < this.map.getLayers().length) {
                    L.e("删除地图图层" + this.map.getLayer(i).getName());
                    if (!this.map.getLayer(i).getName().equals("VEC_C") && !this.map.getLayer(i).getName().contains("IMG_C") && !this.map.getLayer(i).getName().equals("CIA_C") && !this.map.getLayer(i).getName().equals("CVA_C") && !this.baseMapNames.contains(this.map.getLayer(i).getName())) {
                        if (this.map.getLayers()[i] instanceof GraphicsLayer) {
                            ((GraphicsLayer) this.map.getLayers()[i]).removeAll();
                        }
                        L.e(this.baseMapNames.contains(this.map.getLayer(i).getName()) + "删除图层" + this.map.getLayers()[i].getName());
                        this.map.removeLayer(i);
                        i += -1;
                    }
                    i++;
                }
                EventBus.getDefault().post(new MessageEvent(Constant.MESSAGE_EVENT_UPDATA_LAYER_DATA_ALL));
                return;
            case R.id.iv_finger /* 2131230980 */:
                this.ivFinger.setImageResource(R.mipmap.icon_finger_on);
                this.ivAbout.setImageResource(R.mipmap.icon_about_off);
                Intent intent = new Intent(this, PatternLockActivity.class);
                intent.putExtra("isLogin", false);
                startActivity(intent);
                return;
            case R.id.iv_layer /* 2131230982 */:
                initImageBg();
                this.llMore.setVisibility(8);
                this.ivLayer.setImageResource(R.mipmap.icon_layer_on);
                this.viewPager.setCurrentItem(0, false);
                if (this.nowViewClick.equals("iv_layer")) {
                    MyViewPager myViewPager3 = this.viewPager;
                    myViewPager3.setVisibility(myViewPager3.getVisibility() != 0 ? 0 : 8);
                    this.isOnClick = false;
                } else {
                    this.viewPager.setVisibility(0);
                    this.isOnClick = false;
                }
                this.nowViewClick = "iv_layer";
                return;
            case R.id.iv_location /* 2131230985 */:
                localSwitch(!this.loaclIsOff);
                return;
            case R.id.iv_more /* 2131230987 */:
                stopTimer();
                initImageBg();
                this.viewPager.setVisibility(8);
                this.llStatistic.setVisibility(8);
                if (this.llMore.getVisibility() == 0) {
                    this.ivMore.setImageResource(R.mipmap.icon_more_off);
                    this.llMore.setVisibility(8);
                    return;
                }
                this.llMore.setVisibility(0);
                this.ivMore.setImageResource(R.mipmap.icon_more_on);
                return;
            case R.id.iv_package /* 2131230988 */:
                stopTimer();
                initImageBg();
                this.ivPackage.setImageResource(R.mipmap.icon_package_on);
                this.viewPager.setCurrentItem(3, false);
                if (this.nowViewClick.equals("iv_package")) {
                    MyViewPager myViewPager4 = this.viewPager;
                    myViewPager4.setVisibility(myViewPager4.getVisibility() != 0 ? 0 : 8);
                } else {
                    this.viewPager.setVisibility(0);
                }
                this.nowViewClick = "iv_package";
                return;
            case R.id.iv_pencil /* 2131230989 */:
                initImageBg();
                this.viewPager.setVisibility(8);
                switchPencilWindow(this.ivPencil);
                return;
            case R.id.iv_plan /* 2131230992 */:
                stopTimer();
                initImageBg();
                this.llMore.setVisibility(8);
                this.ivPlan.setImageResource(!getPackageName().equals("com.gisocn.onemap.rs") ? R.mipmap.icon_plan_on : R.mipmap.icon_plan_rssl_on);
                this.ivPlan.setImageResource(R.mipmap.icon_plan_on);
                this.viewPager.setCurrentItem(2, false);
                if (this.nowViewClick.equals("iv_plan")) {
                    MyViewPager myViewPager5 = this.viewPager;
                    myViewPager5.setVisibility(myViewPager5.getVisibility() != 0 ? 0 : 8);
                } else {
                    this.viewPager.setVisibility(0);
                }
                this.nowViewClick = "iv_plan";
                return;
            case R.id.iv_query /* 2131230995 */:
                stopTimer();
                initImageBg();
                this.ivQuery.setImageResource(R.mipmap.icon_query_on);
                this.viewPager.setCurrentItem(1, false);
                if (this.nowViewClick.equals("iv_query")) {
                    MyViewPager myViewPager6 = this.viewPager;
                    myViewPager6.setVisibility(myViewPager6.getVisibility() != 0 ? 0 : 8);
                } else {
                    this.viewPager.setVisibility(0);
                }
                this.nowViewClick = "iv_query";
                return;
            case R.id.iv_query_location /* 2131230996 */:
                initImageBg();
                this.ivQueryLocation.setImageResource(R.mipmap.icon_local_search_on);
                this.viewPager.setCurrentItem(7, false);
                if (this.nowViewClick.equals("iv_query_location")) {
                    MyViewPager myViewPager7 = this.viewPager;
                    myViewPager7.setVisibility(myViewPager7.getVisibility() != 0 ? 0 : 8);
                    this.isOnClick = false;
                } else {
                    this.viewPager.setVisibility(0);
                    this.isOnClick = false;
                }
                this.nowViewClick = "iv_query_location";
                return;
            case R.id.iv_ruler /* 2131230998 */:
                initImageBg();
                this.viewPager.setVisibility(8);
                switchRulerWindow(this.ivRuler);
                return;
            case R.id.iv_search /* 2131230999 */:
                ServiceSettings.updatePrivacyShow(this, true, true);
                ServiceSettings.updatePrivacyAgree(this, true);
                if (this.searchContentView == null) {
                    View inflate = View.inflate(this, R.layout.tools_search_layout, null);
                    this.searchContentView = inflate;
                    inflate.measure(0, 0);
                }
                if (this.searchPopupWindow == null) {
                    PopupWindow popupWindow = new PopupWindow(this.searchContentView, -2, -2, true);
                    this.searchPopupWindow = popupWindow;
                    this.popupWindows.add(popupWindow);
                    this.close_Btn = (TextView) this.searchContentView.findViewById(R.id.popup_close);
                    this.search_Btn = (TextView) this.searchContentView.findViewById(R.id.popup_search);
                    this.searchEditText = (EditText) this.searchContentView.findViewById(R.id.search_edit);
                }
                this.searchPopupWindow.setOutsideTouchable(false);
                this.searchPopupWindow.setFocusable(true);
                this.searchPopupWindow.setBackgroundDrawable(new BitmapDrawable());
                this.searchPopupWindow.showAtLocation(this.map, 17, 0, -400);
                this.close_Btn.setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.10
                    @Override // android.view.View.OnClickListener
                    public void onClick(View view2) {
                        MainActivity.this.searchPopupWindow.dismiss();
                    }
                });
                this.search_Btn.setOnClickListener(new AnonymousClass11());
                return;
            case R.id.iv_whole /* 2131231006 */:
                this.map.setExtent(new Envelope(Double.parseDouble(this.appConfig.getBaseMap().getInitExtent().getXmin()), Double.parseDouble(this.appConfig.getBaseMap().getInitExtent().getYmin()), Double.parseDouble(this.appConfig.getBaseMap().getInitExtent().getXmax()), Double.parseDouble(this.appConfig.getBaseMap().getInitExtent().getYmax())), 0);
                return;
            case R.id.ll_imgc_bottom /* 2131231040 */:
                L.e("点击了底部");
                boolean z = this.ll_imgc_recycle.getVisibility() != 0;
                this.imgcOpen = z;
                this.ll_imgc_recycle.setVisibility(z ? 0 : 8);
                Glide.with((FragmentActivity) this).load(Integer.valueOf(this.imgcOpen ? R.mipmap.ic_imgc_open : R.mipmap.ic_imgc_close)).into(this.iv_shrinkage_action);
                return;
            case R.id.ll_imgc_vec /* 2131231043 */:
                switchBaseMap(TDTConstant.LAYER_NAME_VECTOR);
                return;
            case R.id.ll_ll_imgc_image /* 2131231046 */:
                switchBaseMap(TDTConstant.LAYER_NAME_IMAGE);
                return;
            case R.id.tv_bar /* 2131231381 */:
                this.pieChart.setVisibility(8);
                this.barChart.setVisibility(0);
                this.tvPie.setBackgroundColor(ContextCompat.getColor(this, R.color.colorWhite));
                this.tvPie.setTextColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
                this.tvBar.setBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
                this.tvBar.setTextColor(ContextCompat.getColor(this, R.color.colorWhite));
                initBarChart();
                return;
            case R.id.tv_pie /* 2131231432 */:
                initPieChart();
                this.pieChart.setVisibility(0);
                this.barChart.setVisibility(8);
                this.tvPie.setBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
                this.tvPie.setTextColor(ContextCompat.getColor(this, R.color.colorWhite));
                this.tvBar.setBackgroundColor(ContextCompat.getColor(this, R.color.colorWhite));
                this.tvBar.setTextColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
                return;
            case R.id.tv_static_close /* 2131231446 */:
                this.llStatistic.setVisibility(8);
                return;
            default:
                return;
        }
    }

    /* renamed from: com.gisocn.onemap.ui.activity.MainActivity$11  reason: invalid class name */
    /* loaded from: classes2.dex */
    class AnonymousClass11 implements View.OnClickListener {
        AnonymousClass11() {
        }

        @Override // android.view.View.OnClickListener
        public void onClick(View view) {
            L.e("地名搜索");
            if (MainActivity.this.searchEditText.getText().toString().trim().length() > 0) {
                MainActivity.this.searchPopupWindow.dismiss();
                final String trim = MainActivity.this.appConfig.getCity().trim();
                L.e("cityCode______________" + trim);
                PoiSearch.Query query = new PoiSearch.Query(MainActivity.this.searchEditText.getText().toString(), "", trim);
                try {
                    ServiceSettings.updatePrivacyShow(MainActivity.this, true, true);
                    ServiceSettings.updatePrivacyAgree(MainActivity.this, true);
                    MainActivity mainActivity = MainActivity.this;
                    mainActivity.poiSearch = new PoiSearch(mainActivity, query);
                    MainActivity.this.poiSearch.searchPOIAsyn();
                    MainActivity.this.poiSearch.setOnPoiSearchListener(new PoiSearch.OnPoiSearchListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.11.1
                        @Override // com.amap.api.services.poisearch.PoiSearch.OnPoiSearchListener
                        public void onPoiItemSearched(PoiItem poiItem, int i) {
                        }

                        @Override // com.amap.api.services.poisearch.PoiSearch.OnPoiSearchListener
                        public void onPoiSearched(PoiResult poiResult, int i) {
                            MainActivity.this.searchList.clear();
                            L.e("" + new Gson().toJson(poiResult));
                            Iterator<PoiItem> it = poiResult.getPois().iterator();
                            while (it.hasNext()) {
                                PoiItem next = it.next();
                                if (next.getCityName().equals(trim) || next.getAdName().equals(trim)) {
                                    MainActivity.this.searchList.add(next);
                                }
                            }
                            if (MainActivity.this.searchList.size() > 0) {
                                if (MainActivity.this.searchItemContentView == null) {
                                    MainActivity.this.searchItemContentView = View.inflate(MainActivity.this, R.layout.tools_searchitem_layout, null);
                                }
                                if (MainActivity.this.searchItemPopuWindow == null) {
                                    MainActivity.this.searchItemPopuWindow = new PopupWindow(MainActivity.this.searchItemContentView, ((MainActivity.this.dm.widthPixels - 70) / 4) - 100, -1, true);
                                    MainActivity.this.popupWindows.add(MainActivity.this.searchItemPopuWindow);
                                    MainActivity.this.searchClose_Btn = (TextView) MainActivity.this.searchItemContentView.findViewById(R.id.tv_close);
                                }
                                MainActivity.this.searchItemPopuWindow.setOutsideTouchable(false);
                                MainActivity.this.searchItemPopuWindow.setFocusable(false);
                                MainActivity.this.searchItemPopuWindow.setBackgroundDrawable(new BitmapDrawable());
                                MainActivity.this.searchItemPopuWindow.showAtLocation(MainActivity.this.map, BadgeDrawable.TOP_END, 0, 0);
                                MainActivity.this.switchSerchWindow(MainActivity.this.searchList, MainActivity.this.searchItemContentView);
                                MainActivity.this.searchClose_Btn.setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.11.1.1
                                    @Override // android.view.View.OnClickListener
                                    public void onClick(View view2) {
                                        MainActivity.this.searchItemPopuWindow.dismiss();
                                    }
                                });
                                return;
                            }
                            MainActivity.this.showToast("暂无搜索结果");
                        }
                    });
                    return;
                } catch (AMapException e) {
                    e.printStackTrace();
                    return;
                }
            }
            MainActivity.this.showToast("请输入关键字");
        }
    }

    void switchSerchWindow(List<PoiItem> list, View view) {
        RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.search_recyclerView);
        recyclerView.setLayoutManager(new LinearLayoutManager(view.getContext()));
        SearchAdapter searchAdapter = new SearchAdapter(list);
        this.searchAdapter = searchAdapter;
        recyclerView.setAdapter(searchAdapter);
        this.searchAdapter.setOnItemClickListener(new OnItemClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.12
            @Override // com.gisocn.onemap.interfaces.OnItemClickListener
            public void onItemClick(View view2, int i, int i2) {
            }

            @Override // com.gisocn.onemap.interfaces.OnItemClickListener
            public void onItemClick(View view2, int i) {
                Log.e("searchAdapter-Click:", i + "" + ((PoiItem) MainActivity.this.searchList.get(i)).getTitle());
                LatLonPoint latLonPoint = ((PoiItem) MainActivity.this.searchList.get(i)).getLatLonPoint();
                double WGSLon = GCJ2WGSUtils.WGSLon(latLonPoint.getLatitude(), latLonPoint.getLongitude());
                double WGSLat = GCJ2WGSUtils.WGSLat(latLonPoint.getLatitude(), latLonPoint.getLongitude());
                Log.e("GCJ2WGSUtils", latLonPoint.getLatitude() + "");
                Log.e("GCJ2WGSUtils", latLonPoint.getLongitude() + "");
                Point point = new Point(WGSLon, WGSLat);
                Log.e("wgspoint", point.getX() + "");
                Log.e("wgspoint", point.getY() + "");
                Point point2 = (Point) GeometryEngine.project(point, SpatialReference.create(4326), MainActivity.this.map.getSpatialReference());
                Log.e("mapPoint", point2.getY() + "");
                MainActivity.this.map.setExtent(point2);
                MainActivity.this.loadGeometryLocal(point2, "定位");
                MainActivity.this.map.setScale(2000.0d);
            }
        });
    }

    void boundSearch(LatLonPoint latLonPoint) {
        PoiSearch poiSearch;
        double latitude = latLonPoint.getLatitude();
        double longitude = latLonPoint.getLongitude();
        try {
            poiSearch = new PoiSearch(this, new PoiSearch.Query("", "生活服务", ""));
        } catch (AMapException e) {
            e.printStackTrace();
            poiSearch = null;
        }
        poiSearch.setBound(new PoiSearch.SearchBound(new LatLonPoint(latitude, longitude), 1000));
        poiSearch.setOnPoiSearchListener(new PoiSearch.OnPoiSearchListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.13
            @Override // com.amap.api.services.poisearch.PoiSearch.OnPoiSearchListener
            public void onPoiItemSearched(PoiItem poiItem, int i) {
            }

            @Override // com.amap.api.services.poisearch.PoiSearch.OnPoiSearchListener
            public void onPoiSearched(PoiResult poiResult, int i) {
                Iterator it;
                poiResult.getQuery();
                MainActivity.this.adressList = poiResult.getPois();
                if (MainActivity.this.adressList.size() > 0) {
                    if (MainActivity.this.searchAdressContentView == null) {
                        MainActivity mainActivity = MainActivity.this;
                        mainActivity.searchAdressContentView = View.inflate(mainActivity, R.layout.tools_adress_layout, null);
                        MainActivity.this.searchAdressContentView.measure(0, 0);
                    }
                    if (MainActivity.this.searchAdressPopWindow == null) {
                        MainActivity.this.searchAdressPopWindow = new PopupWindow(MainActivity.this.searchAdressContentView, -2, -2, true);
                        MainActivity.this.popupWindows.add(MainActivity.this.searchAdressPopWindow);
                        String str = "";
                        while (MainActivity.this.adressList.iterator().hasNext()) {
                            str = str + ((PoiItem) it.next()).getTitle() + ";";
                        }
                        ((TextView) MainActivity.this.searchAdressContentView.findViewById(R.id.tv_adress)).setText(str);
                    }
                    MainActivity.this.searchAdressPopWindow.setOutsideTouchable(false);
                    MainActivity.this.searchAdressPopWindow.setFocusable(true);
                    MainActivity.this.searchAdressPopWindow.setBackgroundDrawable(new BitmapDrawable());
                    MainActivity.this.searchAdressPopWindow.showAtLocation(MainActivity.this.map, 17, 85, -250);
                }
            }
        });
        poiSearch.searchPOIAsyn();
    }

    void initBaseMap(int i, boolean z) {
        Layer[] layers;
        Iterator<BaseMap.MapItem> it = this.appConfig.getBaseMap().getMapItem().iterator();
        while (it.hasNext()) {
            BaseMap.MapItem next = it.next();
            Iterator<LayerInfoBean> it2 = next.getGroupLayer().getLayer().iterator();
            while (it2.hasNext()) {
                LayerInfoBean next2 = it2.next();
                String type = next2.getType();
                type.hashCode();
                char c = 65535;
                switch (type.hashCode()) {
                    case 83279:
                        if (type.equals("TPK")) {
                            c = 0;
                            break;
                        }
                        break;
                    case 2668501:
                        if (type.equals("WMTS")) {
                            c = 1;
                            break;
                        }
                        break;
                    case 538920188:
                        if (type.equals("TPK_SQLITE")) {
                            c = 2;
                            break;
                        }
                        break;
                    case 1902669924:
                        if (type.equals("AgsLayer")) {
                            c = 3;
                            break;
                        }
                        break;
                    case 1910283913:
                        if (type.equals("AgsTiled")) {
                            c = 4;
                            break;
                        }
                        break;
                }
                switch (c) {
                    case 0:
                    case 2:
                        L.e("图层名称" + next2.getName());
                        if (FileUtils.getLocalFile(next2.getService().trim(), this).exists()) {
                            ArcGISLocalTiledLayer arcGISLocalTiledLayer = new ArcGISLocalTiledLayer(FileUtils.getLocalFile(next2.getService(), this).getPath());
                            if (mapContains(arcGISLocalTiledLayer)) {
                                break;
                            } else {
                                this.map.addLayer(arcGISLocalTiledLayer);
                                arcGISLocalTiledLayer.setName(com.gisocn.onemap.utils.Utils.getBaseMapName(next.getName(), next2.getName()));
                                break;
                            }
                        } else if (!z || i != 0) {
                            if (z && i == 1) {
                                showToast("未找到影像底图");
                                break;
                            }
                        } else {
                            showToast("未找到矢量底图");
                            break;
                        }
                        break;
                    case 1:
                        TDTInfo tDTInfo = new TDTInfo();
                        Iterator<LayerParamDefine.Layer> it3 = this.appConfig.getLayerParamDefine().getLayers().iterator();
                        while (it3.hasNext()) {
                            LayerParamDefine.Layer next3 = it3.next();
                            if (next3.getName().equals(next.getGroupLayer().getName())) {
                                String str = next3.getParams().getTileurls().getLevel().getcData();
                                if (next.getName().equals("地图")) {
                                    tDTInfo.setMapType(TDTType.VEC_C);
                                } else if (next.getName().equals("影像")) {
                                    tDTInfo.setMapType(TDTType.IMG_C);
                                }
                                tDTInfo.setUrl(str.substring(0, str.indexOf(TimeModel.NUMBER_FORMAT)).trim());
                                TDTTiedMapLayer tDTTiedMapLayer = new TDTTiedMapLayer(tDTInfo, this.appConfig.getBaseMap().getInitExtent(), Integer.parseInt(this.appConfig.getShapeFileWkid()));
                                if (tDTInfo.getMapType() == TDTType.IMG_C) {
                                    tDTTiedMapLayer.setName("IMG_C");
                                } else if (tDTInfo.getMapType() == TDTType.VEC_C) {
                                    tDTTiedMapLayer.setName("VEC_C");
                                }
                                if (!mapContains(tDTTiedMapLayer)) {
                                    this.map.addLayer(tDTTiedMapLayer);
                                }
                            }
                        }
                        break;
                    case 3:
                        ArrayList<DynamicMapServiceLayer> arrayList = new ArrayList<>();
                        arrayList.add(new DynamicMapServiceLayer(com.gisocn.onemap.utils.Utils.getBaseMapName(next.getName(), next2.getName()), next2.getService().trim(), next2));
                        loadService(arrayList);
                        break;
                    case 4:
                        ArrayList<DynamicMapServiceLayer> arrayList2 = new ArrayList<>();
                        arrayList2.add(new DynamicMapServiceLayer(com.gisocn.onemap.utils.Utils.getBaseMapName(next.getName(), next2.getName()), next2.getService().trim(), next2));
                        loadTiledService(arrayList2);
                        break;
                }
            }
        }
        for (Layer layer : this.map.getLayers()) {
            L.e("底图图层" + layer.getName());
            if (i == 0) {
                if ("VEC_C".equals(layer.getName())) {
                    layer.setVisible(true);
                } else if ("IMG_C".equals(layer.getName()) || "CIA_C".equals(layer.getName())) {
                    layer.setVisible(false);
                }
            } else if (i == 1) {
                if ("IMG_C".equals(layer.getName()) || "CIA_C".equals(layer.getName())) {
                    layer.setVisible(true);
                } else if ("VEC_C".equals(layer.getName()) || "CVA_C".equals(layer.getName())) {
                    layer.setVisible(false);
                }
            }
        }
        this.map.setExtent(new Envelope(Double.parseDouble(this.appConfig.getBaseMap().getInitExtent().getXmin()), Double.parseDouble(this.appConfig.getBaseMap().getInitExtent().getYmin()), Double.parseDouble(this.appConfig.getBaseMap().getInitExtent().getXmax()), Double.parseDouble(this.appConfig.getBaseMap().getInitExtent().getYmax())), 0);
    }

    void loadCIA_C() {
        if (isNull(this.CIA_C_Service)) {
            return;
        }
        Layer[] layers = this.map.getLayers();
        int length = layers.length;
        boolean z = true;
        int i = 0;
        while (true) {
            if (i >= length) {
                break;
            }
            Layer layer = layers[i];
            if (layer.getName().equals("VEC_C") && layer.isVisible()) {
                z = false;
            }
            if (layer.getName().equals("CIA_C")) {
                this.map.removeLayer(layer);
                break;
            }
            i++;
        }
        if (FileUtils.getLocalFile(this.CIA_C_Service.trim(), this).exists()) {
            ArcGISLocalTiledLayer arcGISLocalTiledLayer = new ArcGISLocalTiledLayer(FileUtils.getLocalFile(this.CIA_C_Service, this).getPath());
            if (mapContains(arcGISLocalTiledLayer)) {
                return;
            }
            this.map.addLayer(arcGISLocalTiledLayer);
            arcGISLocalTiledLayer.setName("CIA_C");
            arcGISLocalTiledLayer.setVisible(z);
            L.e("加载注记");
        }
    }

    void initBaseMapSG(int i, boolean z) {
        Layer[] layers;
        ArrayList<ImgCLayer> arrayList;
        String str = "0";
        for (BaseMap.MapItem mapItem : this.appConfig.getBaseMap().getMapItem()) {
            for (LayerInfoBean layerInfoBean : mapItem.getGroupLayer().getLayer()) {
                if (mapItem.getName().contains("影像") && !layerInfoBean.getName().contains("注记")) {
                    ImgCLayer imgCLayer = new ImgCLayer();
                    imgCLayer.setLayer(layerInfoBean);
                    imgCLayer.getLayer().setName(com.gisocn.onemap.utils.Utils.getBaseMapName(mapItem.getName(), layerInfoBean.getName()));
                    if ("影像.tpk".equals(imgCLayer.getLayer().getService())) {
                        imgCLayer.setCheck(true);
                        str = "1";
                    }
                    this.imgcSwitchList.add(imgCLayer);
                    this.imgcSwitchListNames.add(imgCLayer.getLayer().getName());
                } else {
                    layerInfoBean.getName().contains("注记");
                }
            }
        }
        if ("0".equals(str) && (arrayList = this.imgcSwitchList) != null && arrayList.size() > 0) {
            this.imgcSwitchList.get(0).setCheck(true);
        }
        L.e("imgcSwitchListNames.size()" + this.imgcSwitchListNames.size());
        Iterator<BaseMap.MapItem> it = this.appConfig.getBaseMap().getMapItem().iterator();
        while (it.hasNext()) {
            BaseMap.MapItem next = it.next();
            Iterator<LayerInfoBean> it2 = next.getGroupLayer().getLayer().iterator();
            while (it2.hasNext()) {
                LayerInfoBean next2 = it2.next();
                this.baseMapNames.add(next2.getName());
                L.e("baseMapNames+++++" + next2.getName());
                String type = next2.getType();
                type.hashCode();
                char c = 65535;
                switch (type.hashCode()) {
                    case 83279:
                        if (type.equals("TPK")) {
                            c = 0;
                            break;
                        }
                        break;
                    case 2668501:
                        if (type.equals("WMTS")) {
                            c = 1;
                            break;
                        }
                        break;
                    case 538920188:
                        if (type.equals("TPK_SQLITE")) {
                            c = 2;
                            break;
                        }
                        break;
                    case 1902669924:
                        if (type.equals("AgsLayer")) {
                            c = 3;
                            break;
                        }
                        break;
                    case 1910283913:
                        if (type.equals("AgsTiled")) {
                            c = 4;
                            break;
                        }
                        break;
                }
                switch (c) {
                    case 0:
                    case 2:
                        L.e("图层名称" + next2.getName());
                        if (FileUtils.getLocalFile(next2.getService().trim(), this).exists()) {
                            if (!next2.getName().contains("注记")) {
                                L.e("!layers.getName().contains(\"注记\")");
                                final ArcGISLocalTiledLayer arcGISLocalTiledLayer = new ArcGISLocalTiledLayer(FileUtils.getLocalFile(next2.getService(), this).getPath());
                                if (this.imgcSwitchListNames.contains(next2.getName())) {
                                    L.e("AAAAAAAA" + next2.getName());
                                    arcGISLocalTiledLayer.setOnStatusChangedListener(new OnStatusChangedListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.14
                                        @Override // com.esri.android.map.event.OnStatusChangedListener
                                        public void onStatusChanged(Object obj, OnStatusChangedListener.STATUS status) {
                                            MainActivity.access$2708(MainActivity.this);
                                            L.e("imgcLoadOverIndex" + MainActivity.this.imgcLoadOverIndex);
                                            L.e("imgcLoadOverIndex" + arcGISLocalTiledLayer.getName() + status.name());
                                            MainActivity.this.loadCIA_C();
                                        }
                                    });
                                } else {
                                    L.e("bbbbbbbbbbbbb" + next2.getName());
                                }
                                if (mapContains(arcGISLocalTiledLayer)) {
                                    break;
                                } else {
                                    L.e(arcGISLocalTiledLayer.getName() + "---底图---" + arcGISLocalTiledLayer.getUrl());
                                    this.map.addLayer(arcGISLocalTiledLayer);
                                    arcGISLocalTiledLayer.setName(com.gisocn.onemap.utils.Utils.getBaseMapName(next.getName(), next2.getName()));
                                    break;
                                }
                            } else {
                                L.e("layers.getName().contains(\"注记111\")");
                                this.CIA_C_Service = next2.getService();
                                break;
                            }
                        } else if (!z || i != 0) {
                            if (z && i == 1) {
                                showToast("未找到影像底图");
                                break;
                            }
                        } else {
                            showToast("未找到矢量底图");
                            break;
                        }
                        break;
                    case 1:
                        TDTInfo tDTInfo = new TDTInfo();
                        String trim = next2.getService().trim();
                        if (next.getName().equals("地图")) {
                            tDTInfo.setMapType(TDTType.VEC_C);
                        } else if (next.getName().equals("影像")) {
                            tDTInfo.setMapType(TDTType.IMG_C);
                        }
                        tDTInfo.setUrl(trim);
                        Layer tDTTiedMapLayer = new TDTTiedMapLayer(tDTInfo, this.appConfig.getBaseMap().getInitExtent(), Integer.parseInt(this.appConfig.getShapeFileWkid()));
                        tDTTiedMapLayer.setName(com.gisocn.onemap.utils.Utils.getBaseMapName(next.getName(), next2.getName()));
                        if (mapContains(tDTTiedMapLayer)) {
                            break;
                        } else {
                            this.map.addLayer(tDTTiedMapLayer);
                            break;
                        }
                    case 3:
                        ArrayList<DynamicMapServiceLayer> arrayList2 = new ArrayList<>();
                        arrayList2.add(new DynamicMapServiceLayer(com.gisocn.onemap.utils.Utils.getBaseMapName(next.getName(), next2.getName()), next2.getService().trim(), next2));
                        loadService(arrayList2);
                        break;
                    case 4:
                        ArrayList<DynamicMapServiceLayer> arrayList3 = new ArrayList<>();
                        arrayList3.add(new DynamicMapServiceLayer(com.gisocn.onemap.utils.Utils.getBaseMapName(next.getName(), next2.getName()), next2.getService().trim(), next2));
                        loadTiledService(arrayList3);
                        break;
                }
            }
        }
        for (Layer layer : this.map.getLayers()) {
            L.e("判断使用哪个作为底图底图图层" + layer.getName());
            if ("VEC_C".equals(layer.getName())) {
                layer.setVisible(true);
            } else {
                layer.setVisible(false);
            }
        }
        this.map.setExtent(new Envelope(Double.parseDouble(this.appConfig.getBaseMap().getInitExtent().getXmin()), Double.parseDouble(this.appConfig.getBaseMap().getInitExtent().getYmin()), Double.parseDouble(this.appConfig.getBaseMap().getInitExtent().getXmax()), Double.parseDouble(this.appConfig.getBaseMap().getInitExtent().getYmax())), 0);
    }

    public void loadTpkSG(ArrayList<LayerInfoBean> arrayList) {
        L.e("loadTpk_____________");
        ArrayList arrayList2 = new ArrayList();
        for (Layer layer : this.map.getLayers()) {
            arrayList2.add(layer.getName());
        }
        ArrayList arrayList3 = new ArrayList();
        Iterator<LayerInfoBean> it = arrayList.iterator();
        while (it.hasNext()) {
            arrayList3.add(it.next().getService().trim());
        }
        Iterator it2 = arrayList3.iterator();
        while (it2.hasNext()) {
            String str = (String) it2.next();
            if (!arrayList2.contains(str)) {
                ArcGISLocalTiledLayer arcGISLocalTiledLayer = new ArcGISLocalTiledLayer(FileUtils.getLocalFile(str, this).getPath());
                arcGISLocalTiledLayer.setName(str);
                if (getPackageName().contains(BuildConfig.APPLICATION_ID)) {
                    arcGISLocalTiledLayer.setOpacity(0.6f);
                }
                this.map.addLayer(arcGISLocalTiledLayer);
                if (getPackageName().contains("com.gisocn.onemap.sg")) {
                    Iterator<LayerInfoBean> it3 = arrayList.iterator();
                    while (it3.hasNext()) {
                        LayerInfoBean next = it3.next();
                        if (next.getService().trim().equals(str)) {
                            this.layerList.add(next);
                            this.allLayers.add(next);
                        }
                        if (next.getService().trim().equals(str) && !isNull(next.getInitialScale().trim())) {
                            this.map.setScale(Long.parseLong(next.getInitialScale().trim()));
                        }
                    }
                }
            }
        }
    }

    public void loadTpk(ArrayList<String> arrayList) {
        L.e("loadTpk_____________");
        ArrayList arrayList2 = new ArrayList();
        for (Layer layer : this.map.getLayers()) {
            arrayList2.add(layer.getName());
        }
        Iterator<String> it = arrayList.iterator();
        while (it.hasNext()) {
            String next = it.next();
            if (!arrayList2.contains(next)) {
                ArcGISLocalTiledLayer arcGISLocalTiledLayer = new ArcGISLocalTiledLayer(FileUtils.getLocalFile(next, this).getPath());
                arcGISLocalTiledLayer.setName(next);
                if (getPackageName().equals(BuildConfig.APPLICATION_ID)) {
                    arcGISLocalTiledLayer.setOpacity(0.6f);
                }
                this.map.addLayer(arcGISLocalTiledLayer);
            }
        }
    }

    public void loadTiledService(final ArrayList<DynamicMapServiceLayer> arrayList) {
        ExecutorsManager.getInstance().execute(new Runnable() { // from class: com.gisocn.onemap.ui.activity.MainActivity.15
            @Override // java.lang.Runnable
            public void run() {
                L.e("loadService________________");
                Log.e("map.loadService()", "start" + MainActivity.this.map.getLayers().length);
                new ArrayList();
                Iterator it = arrayList.iterator();
                while (it.hasNext()) {
                    DynamicMapServiceLayer dynamicMapServiceLayer = (DynamicMapServiceLayer) it.next();
                    if (!MainActivity.this.layerList.contains(dynamicMapServiceLayer)) {
                        MainActivity.this.layerList.add(dynamicMapServiceLayer.getLayer());
                    }
                    final ArcGISTiledMapServiceLayer arcGISTiledMapServiceLayer = new ArcGISTiledMapServiceLayer(dynamicMapServiceLayer.getUrl());
                    arcGISTiledMapServiceLayer.setName(dynamicMapServiceLayer.getName());
                    if (MainActivity.this.imgcSwitchListNames.contains(dynamicMapServiceLayer.getName())) {
                        arcGISTiledMapServiceLayer.setVisible(false);
                        arcGISTiledMapServiceLayer.setOnStatusChangedListener(new OnStatusChangedListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.15.1
                            @Override // com.esri.android.map.event.OnStatusChangedListener
                            public void onStatusChanged(Object obj, OnStatusChangedListener.STATUS status) {
                                MainActivity.this.loadCIA_C();
                                MainActivity.access$2708(MainActivity.this);
                                L.e("imgcLoadOverIndex" + MainActivity.this.imgcLoadOverIndex);
                                L.e("imgcLoadOverIndex" + arcGISTiledMapServiceLayer.getName() + status.name());
                            }
                        });
                    }
                    MainActivity.this.map.addLayer(arcGISTiledMapServiceLayer);
                    MainActivity.this.allLayers.add(dynamicMapServiceLayer.getLayer());
                }
            }
        });
    }

    public void loadService(ArrayList<DynamicMapServiceLayer> arrayList) {
        Layer[] layers;
        final ArcGISDynamicMapServiceLayer arcGISDynamicMapServiceLayer;
        Log.e("map.loadService()", "start" + this.map.getLayers().length);
        ArrayList arrayList2 = new ArrayList();
        for (Layer layer : this.map.getLayers()) {
            arrayList2.add(layer.getName());
            Log.e("loadService", "____layerName_______" + layer.getName());
        }
        Iterator<DynamicMapServiceLayer> it = arrayList.iterator();
        while (it.hasNext()) {
            DynamicMapServiceLayer next = it.next();
            if (!arrayList2.contains(next.getName())) {
                Log.e("loadService", "_____dynamicName_______" + next.getName());
                if (!this.layerList.contains(arrayList)) {
                    this.layerList.add(next.getLayer());
                }
                if (next.getLayer() == null || next.getLayer().getShowlayers() == null) {
                    arcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer(next.getUrl());
                } else {
                    ArrayList arrayList3 = (ArrayList) new Gson().fromJson(next.getLayer().getShowlayers(), new TypeToken<ArrayList<Integer>>() { // from class: com.gisocn.onemap.ui.activity.MainActivity.16
                    }.getType());
                    int[] iArr = new int[arrayList3.size()];
                    for (int i = 0; i < arrayList3.size(); i++) {
                        iArr[i] = ((Integer) arrayList3.get(i)).intValue();
                    }
                    arcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer(next.getUrl(), iArr);
                }
                Log.e(next.getName(), "" + next.getUrl());
                arcGISDynamicMapServiceLayer.setName(next.getName());
                next.getLayer().setId(arcGISDynamicMapServiceLayer.getID());
                this.allLayers.add(next.getLayer());
                if (getPackageName().equals(BuildConfig.APPLICATION_ID)) {
                    arcGISDynamicMapServiceLayer.setOpacity(0.6f);
                }
                if (this.imgcSwitchListNames.contains(next.getName())) {
                    arcGISDynamicMapServiceLayer.setVisible(false);
                    arcGISDynamicMapServiceLayer.setOnStatusChangedListener(new OnStatusChangedListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.17
                        @Override // com.esri.android.map.event.OnStatusChangedListener
                        public void onStatusChanged(Object obj, OnStatusChangedListener.STATUS status) {
                            MainActivity.access$2708(MainActivity.this);
                            MainActivity.this.loadCIA_C();
                            L.e("imgcLoadOverIndex" + MainActivity.this.imgcLoadOverIndex);
                            L.e("imgcLoadOverIndex" + arcGISDynamicMapServiceLayer.getName() + status.name());
                        }
                    });
                }
                this.map.addLayer(arcGISDynamicMapServiceLayer);
            }
        }
    }

    public void clearTpk(ArrayList<String> arrayList) {
        Layer[] layers;
        Iterator<String> it = arrayList.iterator();
        while (it.hasNext()) {
            String next = it.next();
            for (Layer layer : this.map.getLayers()) {
                if (layer.getName().equals(next) && (layer instanceof ArcGISLocalTiledLayer)) {
                    this.map.removeLayer(layer);
                }
            }
        }
    }

    public void clearService(ArrayList<DynamicMapServiceLayer> arrayList) {
        Layer[] layers;
        Iterator<DynamicMapServiceLayer> it = arrayList.iterator();
        while (it.hasNext()) {
            DynamicMapServiceLayer next = it.next();
            for (Layer layer : this.map.getLayers()) {
                if (layer.getName().equals(next.getName()) && (layer instanceof ArcGISDynamicMapServiceLayer)) {
                    this.map.removeLayer(layer);
                }
            }
        }
        Log.e("clearService", "" + this.map.getLayers().length);
    }

    public void loadWMTSService(ArrayList<DynamicMapServiceLayer> arrayList) {
        Layer[] layers;
        Log.e("map.loadService()", "start" + this.map.getLayers().length);
        ArrayList arrayList2 = new ArrayList();
        for (Layer layer : this.map.getLayers()) {
            arrayList2.add(layer.getName());
            Log.e("loadService", "____layerName_______" + layer.getName());
        }
        Iterator<DynamicMapServiceLayer> it = arrayList.iterator();
        while (it.hasNext()) {
            DynamicMapServiceLayer next = it.next();
            if (!arrayList2.contains(next.getName())) {
                TDTInfo tDTInfo = new TDTInfo();
                L.e("wmts.getName()" + next.getName());
                tDTInfo.setLayerName(next.getName());
                tDTInfo.setMapType(TDTType.LAYER);
                Iterator<LayerParamDefine.Layer> it2 = this.appConfig.getLayerParamDefine().getLayers().iterator();
                while (it2.hasNext()) {
                    LayerParamDefine.Layer next2 = it2.next();
                    if (next2.getName().equals(next.getUrl()) || next2.getName().equals(next.getName())) {
                        tDTInfo.setUrl(next2.getParams().getTileurls().getLevel().getcData());
                        tDTInfo.setLayerName(next2.getName());
                        tDTInfo.setMinZoomLevel(Integer.parseInt(next2.getParams().getTileurls().getLevel().getMinlevel()));
                        tDTInfo.setMaxZoomLevel(Integer.parseInt(next2.getParams().getTileurls().getLevel().getMaxlevel()));
                        BaseMap.InitExtent initExtent = new BaseMap.InitExtent();
                        initExtent.setXmax(next2.getParams().getFullExtent().getXmax());
                        initExtent.setXmin(next2.getParams().getFullExtent().getXmin());
                        initExtent.setYmin(next2.getParams().getFullExtent().getYmin());
                        initExtent.setYmax(next2.getParams().getFullExtent().getYmax());
                        TDTTiedMapLayer tDTTiedMapLayer = new TDTTiedMapLayer(tDTInfo, initExtent, Integer.parseInt(this.appConfig.getShapeFileWkid()));
                        tDTTiedMapLayer.setName(next.getName());
                        this.map.addLayer(tDTTiedMapLayer);
                    }
                }
            }
        }
    }

    public void clearWMTSService(ArrayList<DynamicMapServiceLayer> arrayList) {
        Layer[] layers;
        Iterator<DynamicMapServiceLayer> it = arrayList.iterator();
        while (it.hasNext()) {
            DynamicMapServiceLayer next = it.next();
            for (Layer layer : this.map.getLayers()) {
                if (layer.getName().equals(next.getName())) {
                    this.map.removeLayer(layer);
                }
            }
        }
    }

    public void deleteLastLayer() {
        Layer[] layers;
        MapView mapView;
        MapView mapView2;
        MapView mapView3;
        MapView mapView4;
        int i = 0;
        for (Layer layer : this.map.getLayers()) {
            if (layer.getName() == null) {
                return;
            }
            if (layer.getName().equals("VEC_C") || layer.getName().equals("IMG_C")) {
                i++;
            } else {
                Iterator<BaseMap.MapItem> it = this.appConfig.getBaseMap().getMapItem().iterator();
                while (it.hasNext()) {
                    if (it.next().getGroupLayer().getName().equals(layer.getName())) {
                        i++;
                    }
                }
            }
            L.e("layer.getName" + layer.getName());
        }
        if (this.map.getLayers().length <= 0 || this.map.getLayers().length <= i) {
            return;
        }
        this.map.getLayer(mapView.getLayers().length - 1).getName();
        if (this.handPaintLayer != null) {
            if (this.map.getLayer(mapView4.getLayers().length - 1).getName().equals(this.handPaintLayer.getName())) {
                this.handPaintLayer.removeAll();
                this.measurePoints.clear();
                TextView textView = this.tv_data;
                if (textView != null) {
                    textView.setText("暂无测量结果");
                    this.distanceSum = Utils.DOUBLE_EPSILON;
                    return;
                }
                return;
            }
        }
        if (this.map.getLayer(mapView2.getLayers().length - 1).getName().equals(this.highLightLayer.getName())) {
            this.highLightLayer.removeAll();
            return;
        }
        if (this.map.getLayer(mapView3.getLayers().length - 1).getName().equals(this.graphicsLayer.getName())) {
            this.graphicsLayer.removeAll();
        }
    }

    public void loadFeature(List<Feature> list, String str) {
        this.graphics = new Graphic[list.size()];
        Log.e("loadFeature", "" + this.map.getLayers().length);
        SimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol((int) R.color.colorHightGreen);
        for (int i = 0; i < list.size(); i++) {
            this.graphics[i] = new Graphic(list.get(i).getGeometry(), simpleFillSymbol, list.get(i).getAttributes());
            if (i == list.size() - 1) {
                Message message = new Message();
                message.what = 1;
                Bundle bundle = new Bundle();
                bundle.putString("layerName", str);
                message.setData(bundle);
                this.handler.sendMessage(message);
            }
        }
        Log.e("addLayer__", "" + this.map.getLayers().length);
        Log.e("addLayer__", "" + this.map.getLayers().length);
    }

    public void getLandInfo(final ArrayList<VectorQuery> arrayList) {
        LandInfoPopWindow landInfoPopWindow = this.landInfoPopWindow;
        if (landInfoPopWindow == null) {
            LandInfoPopWindow landInfoPopWindow2 = new LandInfoPopWindow(arrayList, this, ((getResources().getDisplayMetrics().widthPixels - 70) / 4) - 100, -1);
            this.landInfoPopWindow = landInfoPopWindow2;
            this.popupWindows.add(landInfoPopWindow2);
            this.landInfoPopWindow.setOnItemClickListener(new OnItemClickChildListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.18
                @Override // com.gisocn.onemap.interfaces.OnItemClickChildListener
                public void onItemClick(View view, int i, int i2) {
                    String str = Constant.SAVE_PATH_SHP;
                    String shpName = ((VectorQuery) arrayList.get(i)).getShpName();
                    ((VectorQuery) arrayList.get(i)).getFeatures().get(i2);
                    String substring = shpName.substring(0, shpName.indexOf("."));
                    ((MainPresenter) MainActivity.this.presenter).getXmlInfo(str + substring + ".xml", i, i2);
                }
            });
        } else {
            landInfoPopWindow.updata(new ArrayList<>(arrayList));
        }
        this.landInfoPopWindow.showAtLocation(getWindow().getDecorView(), GravityCompat.END, 0, 0);
    }

    public void getLandInfos(final ArrayList<LayerQueryInfo> arrayList, final ArrayList<DynamicInfo> arrayList2) {
        L.e("getLandInfos____" + arrayList2.size());
        if (arrayList.size() == 0 && arrayList2.size() == 0) {
            showToast("未查询到地块信息");
            return;
        }
        LandInfosPopWindow landInfosPopWindow = this.landInfosPopWindow;
        if (landInfosPopWindow == null) {
            LandInfosPopWindow landInfosPopWindow2 = new LandInfosPopWindow(arrayList, arrayList2, this, ((this.dm.widthPixels - 70) / 4) - 100, -1);
            this.landInfosPopWindow = landInfosPopWindow2;
            this.popupWindows.add(landInfosPopWindow2);
            this.landInfosPopWindow.setOnItemClickListener(new OnItemClickChildListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.19
                @Override // com.gisocn.onemap.interfaces.OnItemClickChildListener
                public void onItemClick(View view, int i, int i2) {
                    String str = Constant.SAVE_PATH + "shp/" + ((LayerQueryInfo) arrayList.get(i)).getXmlName();
                    Log.e("position:", "" + i + ";position1" + i2);
                    StringBuilder sb = new StringBuilder();
                    sb.append("");
                    sb.append(((LayerQueryInfo) arrayList.get(i)).getList().get(i2).get("PK_UID"));
                    Log.e("PK_UID:", sb.toString());
                    MainActivity.this.PK_UID = Integer.parseInt(((LayerQueryInfo) arrayList.get(i)).getList().get(i2).get("PK_UID").getAsString());
                    MainActivity.this.layerName = ((LayerQueryInfo) arrayList.get(i)).getLayerName();
                    if (((LayerQueryInfo) arrayList.get(i)).getList().get(i2).get("displayField") != null) {
                        String asString = ((LayerQueryInfo) arrayList.get(i)).getList().get(i2).get("displayField").getAsString();
                        if (((LayerQueryInfo) arrayList.get(i)).getList().get(i2).get(asString.toUpperCase()) != null) {
                            MainActivity.this.displayField = ((LayerQueryInfo) arrayList.get(i)).getList().get(i2).get(asString.toUpperCase()).getAsString();
                        } else {
                            MainActivity.this.displayField = ((LayerQueryInfo) arrayList.get(i)).getList().get(i2).get(asString).getAsString();
                        }
                    }
                    if (MainActivity.this.graphicsLayer != null) {
                        MainActivity.this.graphicsLayer.removeAll();
                    }
                    if (MainActivity.this.highLightLayer != null) {
                        MainActivity.this.highLightLayer.removeAll();
                    }
                    ((MainPresenter) MainActivity.this.presenter).getXmlInfo(str, i, i2);
                }
            });
            this.landInfosPopWindow.setOnItemClickDynamicListener(new OnItemClickChildListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.20
                @Override // com.gisocn.onemap.interfaces.OnItemClickChildListener
                public void onItemClick(View view, int i, int i2) {
                    L.e("setOnItemClickDynamicListenerposition" + i + "position1" + i2);
                    if (MainActivity.this.highLightLayer != null) {
                        MainActivity.this.highLightLayer.removeAll();
                    }
                    if (MainActivity.this.graphicsLayer != null) {
                        MainActivity.this.graphicsLayer.removeAll();
                    }
                    if (((DynamicInfo) arrayList2.get(i)).getGetGraphics().get(i2).getGeometry() == null) {
                        L.e("地块Geometry为空");
                    } else {
                        L.e("地块Geometry不为空");
                    }
                    StringBuilder sb = new StringBuilder();
                    sb.append("(dm.widthPixels - 70) / 3 - 100");
                    sb.append(((MainActivity.this.dm.widthPixels - 70) / 3) - 100);
                    L.e(sb.toString());
                    if (((DynamicInfo) arrayList2.get(i)).getGetGraphics().get(i2).getGeometry() == null || ((DynamicInfo) arrayList2.get(i)).getGetGraphics().get(i2).getGeometry().getType() == Geometry.Type.POINT) {
                        MainActivity.this.map.setExtent(((DynamicInfo) arrayList2.get(i)).getGetGraphics().get(i2).getGeometry());
                    } else {
                        MapView mapView = MainActivity.this.map;
                        Geometry geometry = ((DynamicInfo) arrayList2.get(i)).getGetGraphics().get(i2).getGeometry();
                        double d = ((MainActivity.this.dm.widthPixels - 70) / 3) - 100;
                        Double.isNaN(d);
                        mapView.setExtent(geometry, (int) (d * 1.75d));
                        MainActivity.this.map.zoomin();
                        MainActivity.this.map.zoomin();
                        MainActivity.this.map.zoomin();
                        MainActivity.this.map.zoomin();
                    }
                    MainActivity.this.loadGeometry(((DynamicInfo) arrayList2.get(i)).getGetGraphics().get(i2).getGeometry(), "", 2);
                    MainActivity.this.dynamicDetailInfoPopWindow(((DynamicInfo) arrayList2.get(i)).getDetaileInfo().get(i2).getDetaileInfos(), null, ((DynamicInfo) arrayList2.get(i)).getLayerName(), ((DynamicInfo) arrayList2.get(i)).getDisplayFieldName().get(i2));
                }
            });
        } else {
            landInfosPopWindow.updata(new ArrayList<>(arrayList), new ArrayList<>(arrayList2));
        }
        this.landInfosPopWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.21
            @Override // android.widget.PopupWindow.OnDismissListener
            public void onDismiss() {
                if (MainActivity.this.highLightLayer != null) {
                    MainActivity.this.highLightLayer.removeAll();
                }
            }
        });
        this.landInfosPopWindow.showAtLocation(getWindow().getDecorView(), GravityCompat.END, 0, 0);
    }

    public void showLandInfoDetailPopWindow(ArrayList<LandInfo> arrayList) {
        int i;
        LandInfoDetailPopWindow landInfoDetailPopWindow = this.landInfoDetailPopWindow;
        if (landInfoDetailPopWindow == null) {
            DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
            if (getPackageName().equals(BuildConfig.APPLICATION_ID)) {
                i = (displayMetrics.widthPixels - 70) / 4;
            } else {
                i = (displayMetrics.widthPixels - 70) / 3;
            }
            LandInfoDetailPopWindow landInfoDetailPopWindow2 = new LandInfoDetailPopWindow(this.mContext, arrayList, i - 100, -1);
            this.landInfoDetailPopWindow = landInfoDetailPopWindow2;
            this.popupWindows.add(landInfoDetailPopWindow2);
        } else {
            landInfoDetailPopWindow.updateData(arrayList);
        }
        this.landInfoDetailPopWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.22
            @Override // android.widget.PopupWindow.OnDismissListener
            public void onDismiss() {
                if (MainActivity.this.highLightLayer != null) {
                    MainActivity.this.highLightLayer.removeAll();
                }
            }
        });
        this.landInfoDetailPopWindow.showAtLocation(this.mActivity.getWindow().getDecorView(), GravityCompat.END, 0, 0);
    }

    public void detailLandInfoPopWindow(ArrayList<LandInfo> arrayList, Geometry geometry, String str, String str2, String str3, String str4) {
        int i;
        L.e("displayField" + str2);
        DetailLandInfoPopWindow detailLandInfoPopWindow = this.detailLandInfoPopWindow;
        if (detailLandInfoPopWindow == null) {
            DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
            if (getPackageName().equals(BuildConfig.APPLICATION_ID)) {
                L.e("地块信息框1");
                i = ((displayMetrics.widthPixels - 70) / 4) - 100;
            } else {
                i = ((displayMetrics.widthPixels - 70) / 3) - 100;
                L.e("地块信息框2");
            }
            DetailLandInfoPopWindow detailLandInfoPopWindow2 = new DetailLandInfoPopWindow(this, arrayList, geometry, i, -1, str, str2, str3, Integer.parseInt(str4));
            this.detailLandInfoPopWindow = detailLandInfoPopWindow2;
            this.popupWindows.add(detailLandInfoPopWindow2);
        } else {
            detailLandInfoPopWindow.upData(new ArrayList<>(arrayList), str, str2, str3, Integer.parseInt(str4), geometry);
        }
        this.detailLandInfoPopWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.23
            @Override // android.widget.PopupWindow.OnDismissListener
            public void onDismiss() {
                L.e("dynamicDetailInfoPopWindow_onDismiss");
                if (MainActivity.this.highLightLayer != null) {
                    MainActivity.this.highLightLayer.removeAll();
                }
            }
        });
        this.detailLandInfoPopWindow.showAtLocation(getWindow().getDecorView(), GravityCompat.END, 0, 0);
    }

    public void dynamicDetailInfoPopWindow(List<DynamicInfo.DetaileInfo> list, Geometry geometry, String str, String str2) {
        L.e("displayField" + str2);
        DynamicDetailInfoPopWindow dynamicDetailInfoPopWindow = this.dynamicDetailInfoPopWindow;
        if (dynamicDetailInfoPopWindow == null) {
            DynamicDetailInfoPopWindow dynamicDetailInfoPopWindow2 = new DynamicDetailInfoPopWindow(this, list, geometry, ((getResources().getDisplayMetrics().widthPixels - 70) / 4) - 100, -1, str, str2);
            this.dynamicDetailInfoPopWindow = dynamicDetailInfoPopWindow2;
            this.popupWindows.add(dynamicDetailInfoPopWindow2);
        } else {
            dynamicDetailInfoPopWindow.upData(new ArrayList<>(list), str, str2, geometry);
        }
        this.dynamicDetailInfoPopWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.24
            @Override // android.widget.PopupWindow.OnDismissListener
            public void onDismiss() {
                L.e("dynamicDetailInfoPopWindow_onDismiss");
                if (MainActivity.this.highLightLayer != null) {
                    MainActivity.this.highLightLayer.removeAll();
                }
            }
        });
        this.dynamicDetailInfoPopWindow.showAtLocation(getWindow().getDecorView(), GravityCompat.END, 0, 0);
    }

    @Override // com.gisocn.onemap.view.MainView
    public void getAppConfig(AppConfig appConfig) {
        this.appConfig = appConfig;
        L.e("MainActivity_getAppConfig");
        initFragment();
        this.params.width = this.width;
        this.viewPager.setLayoutParams(this.params);
        initImageBg();
        this.llMore.setVisibility(8);
        this.ivLayer.setImageResource(R.mipmap.icon_layer_on);
        this.viewPager.setCurrentItem(0, false);
        initBaseMap(0, false);
    }

    public AppConfig getAppConfig() {
        return this.appConfig;
    }

    public AppConfig getNewAppConfig() {
        return (AppConfig) new Gson().fromJson(getIntent().getStringExtra("appConfig"), (Class<Object>) AppConfig.class);
    }

    @Override // com.gisocn.onemap.view.MainView
    public void getDataSuccess() {
        ((MainPresenter) this.presenter).getAppConfigData();
    }

    @Override // com.gisocn.onemap.view.MainView
    public void getDataFail(String str) {
        showToast(str);
    }

    @Override // com.gisocn.onemap.view.MainView
    public void mapQuerySuccess(ArrayList<VectorQuery> arrayList) {
        this.lists.clear();
        this.lists.addAll(new ArrayList(arrayList));
        this.handler.sendEmptyMessage(2);
    }

    @Override // com.gisocn.onemap.view.MainView
    public void getLandXmlSuccess(QueryXML queryXML, int i, int i2) {
        this.queryXML = queryXML;
        String str = this.layerQueryInfos.get(i).getXmlName().substring(0, this.layerQueryInfos.get(i).getXmlName().indexOf(".")) + ".db";
        File file = new File(Constant.SAVE_PATH_SHP + str);
        Log.e("dbName", str);
        if (file.exists()) {
            ((MainPresenter) this.presenter).sqlQueryLandInfo(Constant.SAVE_PATH_SHP + str, this.queryXML.getOrder().trim(), this.PK_UID, i, i2);
            return;
        }
        L.e(Constant.SAVE_PATH_SHP + str + "不存在");
    }

    @Override // com.gisocn.onemap.view.MainView
    public void sqlQuery(ArrayList<LayerQueryInfo> arrayList, Point point) {
        this.tpkQueryEnd = true;
        Log.e("LayerQueryInfos", arrayList.size() + "");
        Log.e("LayerQueryInfos", new Gson().toJson(arrayList));
        this.layerQueryInfos.clear();
        this.layerQueryInfos.addAll(arrayList);
        if (arrayList.size() > 0) {
            Message message = new Message();
            Bundle bundle = new Bundle();
            bundle.putSerializable("list", arrayList);
            message.setData(bundle);
            message.what = 1000;
            this.handler.sendMessage(message);
        }
    }

    @Override // com.gisocn.onemap.view.MainView
    public void sqlQueryLandInfo(JsonObject jsonObject, int i, int i2, int i3, String str, int i4) {
        Log.e("layerQueryInfos", this.layerQueryInfos.size() + "");
        Log.e("layerQueryInfos", "position:" + i2 + ";position1" + i3);
        StringBuilder sb = new StringBuilder();
        sb.append("");
        sb.append(this.layerQueryInfos.get(0).getGeometries().size());
        Log.e("layerQueryInfos", sb.toString());
        this.landInfos.clear();
        Iterator<QueryXML.Field> it = this.queryXML.getFields().iterator();
        while (it.hasNext()) {
            QueryXML.Field next = it.next();
            if (jsonObject.get(next.getName() + "") != null) {
                LandInfo landInfo = new LandInfo();
                landInfo.setName(next.getAliasname());
                Log.e("field.getName: ", jsonObject.get(next.getName()) + "");
                if (jsonObject.get(next.getName() + "").equals("null")) {
                    landInfo.setValue("");
                } else {
                    landInfo.setValue(jsonObject.get(next.getName() + "").getAsString());
                }
                this.landInfos.add(landInfo);
            }
        }
        Message message = new Message();
        Bundle bundle = new Bundle();
        bundle.putString("db", str);
        bundle.putInt("id", i4);
        message.setData(bundle);
        message.what = 1001;
        message.arg1 = i2;
        message.arg2 = i3;
        this.handler.sendMessage(message);
    }

    @Override // com.gisocn.onemap.view.MainView
    public void getAppVersionSuccess(AppVersion appVersion) {
        if (Integer.parseInt(appVersion.getVersion()) > PackageUtils.getVersionCode(this)) {
            dismissProgressDialog();
            AppVersionManager appVersionManager = new AppVersionManager(this);
            appVersionManager.upDateAppVersion(appVersion.getInstallUrl(), appVersion.getVersionShort());
            appVersionManager.updaResult(new AppVersionManager.IUpdataResult() { // from class: com.gisocn.onemap.ui.activity.MainActivity.26
                @Override // com.gisocn.onemap.utils.AppVersionManager.IUpdataResult
                public void updataResult() {
                    Log.d("取消更新:", "取消更新:");
                }
            });
        }
    }

    @Override // com.gisocn.onemap.view.MainView
    public void getTpkQueryFail(String str) {
        this.tpkQueryEnd = true;
    }

    private void showAboutSoftDialog(AboutSoftware aboutSoftware, VersionLog versionLog) {
        AboutSoftwareDialog aboutSoftwareDialog = new AboutSoftwareDialog();
        aboutSoftwareDialog.initData(aboutSoftware, versionLog, this);
        aboutSoftwareDialog.show(getSupportFragmentManager(), "fingerprint");
    }

    private void showAboutSoftDialog(String str, String str2) {
        AboutSoftwareDialog aboutSoftwareDialog = new AboutSoftwareDialog();
        aboutSoftwareDialog.initData(str, str2);
        aboutSoftwareDialog.show(getSupportFragmentManager(), "fingerprint");
    }

    void initImageBg() {
        this.ivLayer.setImageResource(R.mipmap.icon_layer_off);
        this.ivQuery.setImageResource(R.mipmap.icon_query_off);
        this.ivPlan.setImageResource(!getPackageName().equals("com.gisocn.onemap.rs") ? R.mipmap.icon_plan_off : R.mipmap.icon_plan_rssl_off);
        this.ivPackage.setImageResource(R.mipmap.icon_package_off);
        this.ivDownload.setImageResource(R.mipmap.icon_download_off);
        this.ivCollection.setImageResource(R.mipmap.icon_collection_off);
        this.ivMore.setImageResource(R.mipmap.icon_more_off);
        this.ivFinger.setImageResource(R.mipmap.icon_finger_off);
        this.ivAbout.setImageResource(R.mipmap.icon_about_off);
        this.ivQueryLocation.setImageResource(R.mipmap.icon_local_search_off);
    }

    void switchCameraWindow(ImageView imageView) {
        this.rightTools.setVisibility(8);
        if (this.photoPopContentView == null) {
            View inflate = View.inflate(this, R.layout.tools_photo_layout, null);
            this.photoPopContentView = inflate;
            inflate.measure(0, 0);
        }
        if (this.photoPopupWindow == null) {
            PopupWindow popupWindow = new PopupWindow(this.photoPopContentView, -2, -2, true);
            this.photoPopupWindow = popupWindow;
            this.popupWindows.add(popupWindow);
            this.photorecyclerView = (RecyclerView) this.photoPopContentView.findViewById(R.id.photo_recycle);
            this.photoTools = (LinearLayout) this.photoPopContentView.findViewById(R.id.photo_tool_layout);
            this.bigImage = (ImageView) this.photoPopContentView.findViewById(R.id.bigImage);
            this.bigPhotoName = (TextView) this.photoPopContentView.findViewById(R.id.photoName);
            this.photorecyclerView.setLayoutManager(new StaggeredGridLayoutManager(3, 1));
            PhotoToolsAdapter photoToolsAdapter = new PhotoToolsAdapter(this.photoInfoArrayList, this);
            this.adapter = photoToolsAdapter;
            this.photorecyclerView.setAdapter(photoToolsAdapter);
            this.adapter.setOnItemClickListener(new OnItemClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.27
                @Override // com.gisocn.onemap.interfaces.OnItemClickListener
                public void onItemClick(View view, int i, int i2) {
                }

                @Override // com.gisocn.onemap.interfaces.OnItemClickListener
                public void onItemClick(View view, int i) {
                    MainActivity.this.photoLocation.setVisibility(0);
                    MainActivity.this.photoTools.setVisibility(0);
                    MainActivity.this.photorecyclerView.setVisibility(8);
                    MainActivity.this.bigImage.setVisibility(0);
                    MainActivity.this.bigPhotoName.setVisibility(0);
                    Glide.with((FragmentActivity) MainActivity.this).load(((PhotoInfo) MainActivity.this.photoInfoArrayList.get(i)).getPhotoUrl()).into(MainActivity.this.bigImage);
                    MainActivity.this.bigPhotoName.setText(((PhotoInfo) MainActivity.this.photoInfoArrayList.get(i)).getPhotoName());
                    MainActivity.this.currentPosition = i;
                }
            });
            this.photoLocation = (ImageView) this.photoPopContentView.findViewById(R.id.photoLocation);
            ((ImageView) this.photoPopContentView.findViewById(R.id.photolist)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.28
                @Override // android.view.View.OnClickListener
                public void onClick(View view) {
                    MainActivity.this.photoLocation.setVisibility(8);
                    MainActivity.this.photoTools.setVisibility(8);
                    MainActivity.this.photorecyclerView.setVisibility(0);
                    MainActivity.this.bigImage.setVisibility(8);
                    MainActivity.this.bigPhotoName.setVisibility(8);
                }
            });
            ((ImageView) this.photoPopContentView.findViewById(R.id.photodelete)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.29
                @Override // android.view.View.OnClickListener
                public void onClick(View view) {
                    MainActivity.this.showIpDialog();
                }
            });
            ((ImageView) this.photoPopContentView.findViewById(R.id.photoedit)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.30
                @Override // android.view.View.OnClickListener
                public void onClick(View view) {
                    Intent intent = new Intent(MainActivity.this, PhotoEditActibity.class);
                    intent.putExtra("Position", MainActivity.this.currentPosition);
                    MainActivity.this.startActivityForResult(intent, 100);
                }
            });
            ((ImageView) this.photoPopContentView.findViewById(R.id.photomessage)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.31
                @Override // android.view.View.OnClickListener
                public void onClick(View view) {
                    if (MainActivity.this.photoInfoPopContentView == null) {
                        MainActivity mainActivity = MainActivity.this;
                        mainActivity.photoInfoPopContentView = View.inflate(mainActivity, R.layout.tools_popup_photos, null);
                        MainActivity.this.photoInfoPopContentView.measure(0, 0);
                    }
                    if (MainActivity.this.photoInfoPopupWindow == null) {
                        MainActivity.this.photoInfoPopupWindow = new PopupWindow(MainActivity.this.photoInfoPopContentView, -1, -1, true);
                        MainActivity.this.popupWindows.add(MainActivity.this.photoInfoPopupWindow);
                    }
                    MainActivity.this.photoInfoPopupWindow.setOutsideTouchable(false);
                    MainActivity.this.photoInfoPopupWindow.setFocusable(true);
                    MainActivity.this.photoInfoPopupWindow.setBackgroundDrawable(new BitmapDrawable());
                    MainActivity.this.photoInfoPopupWindow.showAtLocation(MainActivity.this.map, 17, 0, 0);
                    final EditText editText = (EditText) MainActivity.this.photoInfoPopContentView.findViewById(R.id.popup_photoName);
                    final EditText editText2 = (EditText) MainActivity.this.photoInfoPopContentView.findViewById(R.id.popup_photoRemark);
                    final TextView textView = (TextView) MainActivity.this.photoInfoPopContentView.findViewById(R.id.popup_photoTime);
                    editText.setText(((PhotoInfo) MainActivity.this.photoInfoArrayList.get(MainActivity.this.currentPosition)).getPhotoName());
                    editText2.setText(((PhotoInfo) MainActivity.this.photoInfoArrayList.get(MainActivity.this.currentPosition)).getPhotoRemark());
                    textView.setText(((PhotoInfo) MainActivity.this.photoInfoArrayList.get(MainActivity.this.currentPosition)).getPhotoTime());
                    ((TextView) MainActivity.this.photoInfoPopContentView.findViewById(R.id.popup_close)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.31.1
                        @Override // android.view.View.OnClickListener
                        public void onClick(View view2) {
                            MainActivity.this.photoInfoPopupWindow.dismiss();
                        }
                    });
                    ((TextView) MainActivity.this.photoInfoPopContentView.findViewById(R.id.popup_confirm)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.31.2
                        @Override // android.view.View.OnClickListener
                        public void onClick(View view2) {
                            PhotoInfo photoInfo = new PhotoInfo();
                            photoInfo.setPhotoName(MainActivity.this.getStr(editText));
                            photoInfo.setPhotoTime(MainActivity.this.getStr(textView));
                            photoInfo.setPhotoRemark(MainActivity.this.getStr(editText2));
                            photoInfo.setPhotoUrl(((PhotoInfo) MainActivity.this.photoInfoArrayList.get(MainActivity.this.currentPosition)).getPhotoUrl());
                            photoInfo.setLatitude(MainActivity.this.latitude);
                            photoInfo.setLongitude(MainActivity.this.longitude);
                            MainActivity.this.photoInfoArrayList.remove(MainActivity.this.currentPosition);
                            MainActivity.this.photoInfoArrayList.add(MainActivity.this.currentPosition, photoInfo);
                            Log.e("photoInfo", new Gson().toJson(MainActivity.this.photoInfoArrayList));
                            SpUtils.put(MainActivity.this, "photo_tag", new Gson().toJson(MainActivity.this.photoInfoArrayList));
                            MainActivity.this.adapter.notifyDataSetChanged();
                            MainActivity.this.photoInfoPopupWindow.dismiss();
                        }
                    });
                }
            });
            ((ImageView) this.photoPopContentView.findViewById(R.id.photoexport)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.32
                @Override // android.view.View.OnClickListener
                public void onClick(View view) {
                    Log.e(TbsReaderView.KEY_FILE_PATH, ((PhotoInfo) MainActivity.this.photoInfoArrayList.get(MainActivity.this.currentPosition)).getPhotoUrl());
                    Bitmap decodeFile = BitmapFactory.decodeFile(Uri.decode(((PhotoInfo) MainActivity.this.photoInfoArrayList.get(MainActivity.this.currentPosition)).getPhotoUrl()).substring(7));
                    MainActivity mainActivity = MainActivity.this;
                    mainActivity.toDCIM(mainActivity, decodeFile, ((PhotoInfo) mainActivity.photoInfoArrayList.get(MainActivity.this.currentPosition)).getPhotoName());
                }
            });
            ((ImageView) this.photoPopContentView.findViewById(R.id.photoshare)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.33
                @Override // android.view.View.OnClickListener
                public void onClick(View view) {
                    MainActivity.this.showToast("未配置分享邮箱.");
                }
            });
            ((ImageView) this.photoPopContentView.findViewById(R.id.photocollec)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.34
                @Override // android.view.View.OnClickListener
                public void onClick(View view) {
                    ((PhotoInfo) MainActivity.this.photoInfoArrayList.get(MainActivity.this.currentPosition)).setCollect(true);
                    Log.e("photoInfo", new Gson().toJson(MainActivity.this.photoInfoArrayList));
                    SpUtils.put(MainActivity.this, "photo_tag", new Gson().toJson(MainActivity.this.photoInfoArrayList));
                    MainActivity.this.showToast("收藏成功");
                    EventBus.getDefault().post(new MessageEvent(Constant.MESSAGE_EVENT_UPDATA_COLLECTION_PHOTO));
                }
            });
        }
        if (!isNull(SpUtils.get(this, "photo_tag", "") + "")) {
            this.photoInfoArrayList.clear();
            this.photoInfoArrayList.addAll((ArrayList) new Gson().fromJson(SpUtils.get(this, "photo_tag", "").toString(), new TypeToken<List<PhotoInfo>>() { // from class: com.gisocn.onemap.ui.activity.MainActivity.35
            }.getType()));
            this.adapter.notifyDataSetChanged();
        }
        this.photoPopupWindow.setOutsideTouchable(false);
        this.photoPopupWindow.setFocusable(false);
        this.photoPopupWindow.setBackgroundDrawable(new BitmapDrawable());
        this.photoPopupWindow.showAtLocation(imageView, BadgeDrawable.TOP_END, 0, 0);
        ((TextView) this.photoPopContentView.findViewById(R.id.tv_close)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.36
            @Override // android.view.View.OnClickListener
            public void onClick(View view) {
                MainActivity.this.photoPopupWindow.dismiss();
                MainActivity.this.rightTools.setVisibility(0);
            }
        });
        ((ImageView) this.photoPopContentView.findViewById(R.id.iv_photoBtn)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.37
            @Override // android.view.View.OnClickListener
            public void onClick(View view) {
                MainActivity.this.applyWritePermission();
            }
        });
        this.photoLocation.setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.38
            @Override // android.view.View.OnClickListener
            public void onClick(View view) {
                Point point = (Point) GeometryEngine.project(new Point(((PhotoInfo) MainActivity.this.photoInfoArrayList.get(MainActivity.this.currentPosition)).getLongitude(), ((PhotoInfo) MainActivity.this.photoInfoArrayList.get(MainActivity.this.currentPosition)).getLatitude()), SpatialReference.create(4326), MainActivity.this.map.getSpatialReference());
                MainActivity.this.map.setExtent(point);
                MainActivity mainActivity = MainActivity.this;
                mainActivity.loadGeometry(point, ((PhotoInfo) mainActivity.photoInfoArrayList.get(MainActivity.this.currentPosition)).getPhotoName(), ((PhotoInfo) MainActivity.this.photoInfoArrayList.get(MainActivity.this.currentPosition)).getPhotoUrl());
            }
        });
        this.photoPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.39
            @Override // android.widget.PopupWindow.OnDismissListener
            public void onDismiss() {
                MainActivity.this.rightTools.setVisibility(0);
            }
        });
    }

    void location() {
        this.openLocation = true;
        Log.e("getLatitude", this.latitude + "");
        Log.e("getLongitude", this.longitude + "");
        double d = this.longitude;
        if (d == Utils.DOUBLE_EPSILON && this.latitude == Utils.DOUBLE_EPSILON) {
            showToast("正在获取位置信息,请稍后再试");
            return;
        }
        GCJ2WGSUtils.WGSLon(this.latitude, d);
        GCJ2WGSUtils.WGSLat(this.latitude, this.longitude);
        Log.e("GCJ2WGSUtils", this.latitude + "");
        Log.e("GCJ2WGSUtils", this.longitude + "");
        Point point = (Point) GeometryEngine.project(new Point(this.longitude, this.latitude), SpatialReference.create(4326), this.map.getSpatialReference());
        this.map.setExtent(point);
        Log.e("setScaleRuler", "longitude + ");
        loadGeometryLocal(point, "定位");
        this.openLocation = false;
    }

    void localSwitch(boolean z) {
        this.map.getLocationDisplayManager().setAutoPanMode(LocationDisplayManager.AutoPanMode.LOCATION);
        if (!z) {
            this.map.getLocationDisplayManager().stop();
            this.loaclIsOff = false;
            return;
        }
        this.map.setScale(10000.0d);
        this.map.getLocationDisplayManager().start();
        this.loaclIsOff = true;
    }

    void locationManager() {
        this.locationManager = (LocationManager) getSystemService("location");
        this.gpsLocationListener = new LocationListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.40
            @Override // android.location.LocationListener
            public void onProviderDisabled(String str) {
            }

            @Override // android.location.LocationListener
            public void onProviderEnabled(String str) {
            }

            @Override // android.location.LocationListener
            public void onStatusChanged(String str, int i, Bundle bundle) {
            }

            @Override // android.location.LocationListener
            public void onLocationChanged(Location location) {
                MainActivity.this.longitude = location.getLongitude();
                MainActivity.this.latitude = location.getLatitude();
                if (MainActivity.this.longitude == Utils.DOUBLE_EPSILON || MainActivity.this.latitude == Utils.DOUBLE_EPSILON || !MainActivity.this.openLocation) {
                    return;
                }
                MainActivity.this.location();
            }
        };
    }

    void initPermission() {
        String[] strArr = {"android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION", "android.permission.WRITE_EXTERNAL_STORAGE"};
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < 3; i++) {
            String str = strArr[i];
            if (ActivityCompat.checkSelfPermission(this, str) != 0) {
                arrayList.add(str);
            } else if (str.equals("android.permission.ACCESS_FINE_LOCATION")) {
                L.e("requestLocationUpdates");
            }
        }
        if (arrayList.size() > 0) {
            ActivityCompat.requestPermissions(this, (String[]) arrayList.toArray(new String[arrayList.size()]), 101);
        }
    }

    public void showIpDialog() {
        LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(this).inflate(R.layout.dialog_photo_delete, (ViewGroup) null);
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setView(linearLayout).setCancelable(false);
        AlertDialog create = builder.create();
        this.setIpDialog = create;
        create.show();
        ((Button) linearLayout.findViewById(R.id.bt_cancel)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.41
            @Override // android.view.View.OnClickListener
            public void onClick(View view) {
                MainActivity.this.setIpDialog.dismiss();
            }
        });
        ((Button) linearLayout.findViewById(R.id.bt_confirm)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.42
            @Override // android.view.View.OnClickListener
            public void onClick(View view) {
                MainActivity.this.setIpDialog.dismiss();
                MainActivity.this.bigPhotoName.setVisibility(8);
                MainActivity.this.photorecyclerView.setVisibility(0);
                MainActivity.this.bigImage.setVisibility(8);
                MainActivity.this.photoInfoArrayList.remove(MainActivity.this.currentPosition);
                SpUtils.put(MainActivity.this, "photo_tag", new Gson().toJson(MainActivity.this.photoInfoArrayList));
                MainActivity.this.adapter.notifyDataSetChanged();
            }
        });
    }

    public void applyWritePermission() {
        String[] strArr = {"android.permission.WRITE_EXTERNAL_STORAGE"};
        if (Build.VERSION.SDK_INT >= 23) {
            if (ContextCompat.checkSelfPermission(this, strArr[0]) == 0) {
                useCamera();
                return;
            } else {
                requestPermissions(new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 1);
                return;
            }
        }
        useCamera();
    }

    private void useCamera() {
        Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
        File file = new File(Constant.SAVE_PATH + "图片/" + System.currentTimeMillis() + ".jpg");
        this.file = file;
        file.getParentFile().mkdirs();
        Log.e("file", this.file.getPath());
        Uri uriForFile = FileProvider.getUriForFile(this, Constant.FILEPROVIDER_AUTHORITY, this.file);
        Log.e("photoUri", "" + uriForFile);
        intent.addFlags(1);
        Log.e("uri", uriForFile.getPath());
        intent.putExtra("output", uriForFile);
        startActivityForResult(intent, this.REQUEST_CAMERA);
    }

    @Override // androidx.fragment.app.FragmentActivity, android.app.Activity, androidx.core.app.ActivityCompat.OnRequestPermissionsResultCallback
    public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
        super.onRequestPermissionsResult(i, strArr, iArr);
        if (i == 1 && iArr[0] == 0) {
            useCamera();
        } else {
            Toast.makeText(this, "需要存储权限", 0).show();
        }
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // androidx.fragment.app.FragmentActivity, android.app.Activity
    public void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        if (i == this.REQUEST_CAMERA && i2 == -1) {
            showphotoInfoPopupWindow(Uri.fromFile(this.file));
        } else if (i != 102 || intent == null || Build.VERSION.SDK_INT < 21) {
        } else {
            parseData(intent, i2);
        }
    }

    private void parseData(final Intent intent, final int i) {
        new Handler().postDelayed(new Runnable() { // from class: com.gisocn.onemap.ui.activity.MainActivity.43
            @Override // java.lang.Runnable
            public void run() {
                MainActivity mainActivity = MainActivity.this;
                mainActivity.mMediaProjection = mainActivity.mediaProjectionManager.getMediaProjection(i, intent);
                MainActivity mainActivity2 = MainActivity.this;
                mainActivity2.mVirtualDisplay = mainActivity2.mMediaProjection.createVirtualDisplay("screen-mirror", MainActivity.this.width, MainActivity.this.height, Resources.getSystem().getDisplayMetrics().densityDpi, 16, MainActivity.this.mImageReader.getSurface(), null, null);
                new Handler().postDelayed(new Runnable() { // from class: com.gisocn.onemap.ui.activity.MainActivity.43.1
                    @Override // java.lang.Runnable
                    public void run() {
                        Image acquireLatestImage = MainActivity.this.mImageReader.acquireLatestImage();
                        if (acquireLatestImage != null) {
                            MainActivity.this.startCapture(acquireLatestImage);
                            return;
                        }
                        MainActivity.this.showToast("截屏失败");
                        if (MainActivity.this.mVirtualDisplay != null) {
                            MainActivity.this.mVirtualDisplay.release();
                            MainActivity.this.mVirtualDisplay = null;
                        }
                    }
                }, 500L);
            }
        }, 500L);
    }

    public void startCapture(Image image) {
        System.currentTimeMillis();
        int width = image.getWidth();
        int height = image.getHeight();
        Image.Plane[] planes = image.getPlanes();
        ByteBuffer buffer = planes[0].getBuffer();
        int pixelStride = planes[0].getPixelStride();
        Bitmap createBitmap = Bitmap.createBitmap(((planes[0].getRowStride() - (pixelStride * width)) / pixelStride) + width, height, Bitmap.Config.ARGB_8888);
        createBitmap.copyPixelsFromBuffer(buffer);
        Bitmap createBitmap2 = Bitmap.createBitmap(createBitmap, 0, 0, width, height);
        image.close();
        showToast("截屏成功");
        if (createBitmap2 != null) {
            VirtualDisplay virtualDisplay = this.mVirtualDisplay;
            if (virtualDisplay != null) {
                virtualDisplay.release();
                this.mVirtualDisplay = null;
            }
            saveImageToGallery(this, createBitmap2);
        }
    }

    public void showphotoInfoPopupWindow(final Uri uri) {
        if (this.photoInfoPopContentView == null) {
            View inflate = View.inflate(this, R.layout.tools_popup_photos, null);
            this.photoInfoPopContentView = inflate;
            inflate.measure(0, 0);
        }
        if (this.photoInfoPopupWindow == null) {
            PopupWindow popupWindow = new PopupWindow(this.photoInfoPopContentView, -1, -1, true);
            this.photoInfoPopupWindow = popupWindow;
            this.popupWindows.add(popupWindow);
        }
        this.photoInfoPopupWindow.setOutsideTouchable(false);
        this.photoInfoPopupWindow.setFocusable(true);
        this.photoInfoPopupWindow.setBackgroundDrawable(new BitmapDrawable());
        this.photoInfoPopupWindow.showAtLocation(this.map, 17, 0, 0);
        final EditText editText = (EditText) this.photoInfoPopContentView.findViewById(R.id.popup_photoName);
        final EditText editText2 = (EditText) this.photoInfoPopContentView.findViewById(R.id.popup_photoRemark);
        final TextView textView = (TextView) this.photoInfoPopContentView.findViewById(R.id.popup_photoTime);
        TextView textView2 = (TextView) this.photoInfoPopContentView.findViewById(R.id.popup_confirm);
        textView.setText(new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss").format(new Date(System.currentTimeMillis())));
        ((TextView) this.photoInfoPopContentView.findViewById(R.id.popup_close)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.44
            @Override // android.view.View.OnClickListener
            public void onClick(View view) {
                MainActivity.this.photoInfoPopupWindow.dismiss();
            }
        });
        textView2.setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.45
            @Override // android.view.View.OnClickListener
            public void onClick(View view) {
                MainActivity mainActivity = MainActivity.this;
                if (!mainActivity.isNull(SpUtils.get(MainActivity.this, "photo_tag", "") + "")) {
                    Gson gson = new Gson();
                    MainActivity.this.photoInfoArrayList.clear();
                    MainActivity.this.photoInfoArrayList.addAll((ArrayList) gson.fromJson(SpUtils.get(MainActivity.this, "photo_tag", "") + "", new TypeToken<List<PhotoInfo>>() { // from class: com.gisocn.onemap.ui.activity.MainActivity.45.1
                    }.getType()));
                }
                PhotoInfo photoInfo = new PhotoInfo();
                photoInfo.setPhotoName(MainActivity.this.getStr(editText));
                photoInfo.setPhotoTime(MainActivity.this.getStr(textView));
                photoInfo.setPhotoRemark(MainActivity.this.getStr(editText2));
                photoInfo.setPhotoUrl(uri.toString());
                photoInfo.setLatitude(MainActivity.this.latitude);
                photoInfo.setLongitude(MainActivity.this.longitude);
                MainActivity.this.photoInfoArrayList.add(photoInfo);
                SpUtils.put(MainActivity.this, "photo_tag", new Gson().toJson(MainActivity.this.photoInfoArrayList));
                SpUtils.get(MainActivity.this, "photo_tag", "");
                MainActivity.this.adapter.notifyDataSetChanged();
                MainActivity.this.photoInfoPopupWindow.dismiss();
            }
        });
    }

    void switchRulerWindow(ImageView imageView) {
        GraphicsLayer graphicsLayer = this.handPaintLayer;
        if (graphicsLayer != null) {
            graphicsLayer.removeAll();
            this.measurePoints.clear();
            this.distanceSum = Utils.DOUBLE_EPSILON;
        }
        this.handPaintLayer = new GraphicsLayer();
        if (this.rulerPopContentView == null) {
            View inflate = View.inflate(this, R.layout.tools_ruler_layout, null);
            this.rulerPopContentView = inflate;
            inflate.measure(0, 0);
        }
        if (this.rulerPopupWindow == null) {
            View view = this.rulerPopContentView;
            PopupWindow popupWindow = new PopupWindow(view, view.getMeasuredWidth(), this.rulerPopContentView.getMeasuredHeight() + 30, true);
            this.rulerPopupWindow = popupWindow;
            this.popupWindows.add(popupWindow);
        }
        this.rulerPopupWindow.setOutsideTouchable(false);
        this.rulerPopupWindow.setFocusable(false);
        this.rulerPopupWindow.setBackgroundDrawable(new BitmapDrawable());
        PopupWindow popupWindow2 = this.rulerPopupWindow;
        popupWindow2.showAtLocation(imageView, 81, 0, popupWindow2.getContentView().getMeasuredHeight() + 100);
        final TextView textView = (TextView) this.rulerPopContentView.findViewById(R.id.ruler_distance);
        final TextView textView2 = (TextView) this.rulerPopContentView.findViewById(R.id.ruler_area);
        final TextView textView3 = (TextView) this.rulerPopContentView.findViewById(R.id.ruler_angle);
        TextView textView4 = (TextView) this.rulerPopContentView.findViewById(R.id.tv_data);
        this.tv_data = textView4;
        textView4.setText("暂无测量结果");
        this.onSingleListenerType = 0;
        textView.setBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
        textView2.setBackgroundColor(ContextCompat.getColor(this, R.color.colorGray));
        textView3.setBackgroundColor(ContextCompat.getColor(this, R.color.colorGray));
        textView.setTextColor(ContextCompat.getColor(this, R.color.colorWhite));
        textView2.setTextColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
        textView3.setTextColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
        textView.setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.46
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
                MainActivity.this.rlMeasureAngle.setVisibility(8);
                MainActivity.this.tv_data.setText("暂无测量结果");
                if (MainActivity.this.handPaintLayer != null) {
                    MainActivity.this.handPaintLayer.removeAll();
                    MainActivity.this.measurePoints.clear();
                    MainActivity.this.distanceSum = Utils.DOUBLE_EPSILON;
                }
                MainActivity.this.onSingleListenerType = 0;
                textView.setBackgroundColor(ContextCompat.getColor(MainActivity.this, R.color.colorPrimaryDark));
                textView2.setBackgroundColor(ContextCompat.getColor(MainActivity.this, R.color.colorGray));
                textView3.setBackgroundColor(ContextCompat.getColor(MainActivity.this, R.color.colorGray));
                textView.setTextColor(ContextCompat.getColor(MainActivity.this, R.color.colorWhite));
                textView2.setTextColor(ContextCompat.getColor(MainActivity.this, R.color.colorPrimaryDark));
                textView3.setTextColor(ContextCompat.getColor(MainActivity.this, R.color.colorPrimaryDark));
            }
        });
        textView2.setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.47
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
                MainActivity.this.tv_data.setText("暂无测量结果");
                MainActivity.this.rlMeasureAngle.setVisibility(8);
                if (MainActivity.this.handPaintLayer != null) {
                    MainActivity.this.handPaintLayer.removeAll();
                    MainActivity.this.measurePoints.clear();
                    MainActivity.this.distanceSum = Utils.DOUBLE_EPSILON;
                }
                MainActivity.this.onSingleListenerType = 1;
                textView.setBackgroundColor(ContextCompat.getColor(MainActivity.this, R.color.colorGray));
                textView2.setBackgroundColor(ContextCompat.getColor(MainActivity.this, R.color.colorPrimaryDark));
                textView3.setBackgroundColor(ContextCompat.getColor(MainActivity.this, R.color.colorGray));
                textView.setTextColor(ContextCompat.getColor(MainActivity.this, R.color.colorPrimaryDark));
                textView2.setTextColor(ContextCompat.getColor(MainActivity.this, R.color.colorWhite));
                textView3.setTextColor(ContextCompat.getColor(MainActivity.this, R.color.colorPrimaryDark));
            }
        });
        textView3.setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.48
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
                MainActivity.this.tv_data.setText("暂无测量结果");
                if (MainActivity.this.handPaintLayer != null) {
                    MainActivity.this.handPaintLayer.removeAll();
                    MainActivity.this.measurePoints.clear();
                    MainActivity.this.distanceSum = Utils.DOUBLE_EPSILON;
                }
                MainActivity.this.onSingleListenerType = 2;
                textView.setBackgroundColor(ContextCompat.getColor(MainActivity.this, R.color.colorGray));
                textView2.setBackgroundColor(ContextCompat.getColor(MainActivity.this, R.color.colorGray));
                textView3.setBackgroundColor(ContextCompat.getColor(MainActivity.this, R.color.colorPrimaryDark));
                textView.setTextColor(ContextCompat.getColor(MainActivity.this, R.color.colorPrimaryDark));
                textView2.setTextColor(ContextCompat.getColor(MainActivity.this, R.color.colorPrimaryDark));
                textView3.setTextColor(ContextCompat.getColor(MainActivity.this, R.color.colorWhite));
                MainActivity.this.rlMeasureAngle.setVisibility(0);
                MainActivity.this.ivPointer.setRotation(0.0f);
            }
        });
        this.ivCompass.setOnTouchListener(new View.OnTouchListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.49
            @Override // android.view.View.OnTouchListener
            public boolean onTouch(View view2, MotionEvent motionEvent) {
                int action = motionEvent.getAction();
                if (action == 0) {
                    MainActivity.this.posX = motionEvent.getX();
                    MainActivity.this.posY = motionEvent.getY();
                } else if (action == 1) {
                    float rotation = MainActivity.this.ivPointer.getRotation();
                    MainActivity mainActivity = MainActivity.this;
                    float rotate = rotation + mainActivity.getRotate(mainActivity.posX, MainActivity.this.posY, motionEvent.getX(), motionEvent.getY(), MainActivity.this.ivCompass.getPivotX(), MainActivity.this.ivCompass.getPivotY());
                    if (rotate > 360.0f || rotate < -360.0f) {
                        rotate %= 360.0f;
                    }
                    MainActivity.this.ivPointer.setRotation(rotate);
                    MainActivity.this.tv_data.setText(com.gisocn.onemap.utils.Utils.getAngle(MainActivity.this.ivPointer.getRotation()));
                }
                return true;
            }
        });
        ((TextView) this.rulerPopContentView.findViewById(R.id.ruler_cancle)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.50
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
            }
        });
        ((TextView) this.rulerPopContentView.findViewById(R.id.ruler_recovery)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.51
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
            }
        });
        ((TextView) this.rulerPopContentView.findViewById(R.id.ruler_clean)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.52
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
                if (MainActivity.this.handPaintLayer != null) {
                    MainActivity.this.handPaintLayer.removeAll();
                    MainActivity.this.measurePoints.clear();
                    MainActivity.this.tv_data.setText("暂无测量结果");
                    MainActivity.this.distanceSum = Utils.DOUBLE_EPSILON;
                }
            }
        });
        ((TextView) this.rulerPopContentView.findViewById(R.id.close)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.53
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
                MainActivity.this.rulerPopupWindow.dismiss();
            }
        });
        this.rulerPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.54
            @Override // android.widget.PopupWindow.OnDismissListener
            public void onDismiss() {
                MainActivity.this.leftTools.setVisibility(0);
                MainActivity.this.rlMeasureAngle.setVisibility(8);
                MainActivity.this.onSingleListenerType = -1;
                if (MainActivity.this.handPaintLayer != null) {
                    MainActivity.this.handPaintLayer.removeAll();
                    MainActivity.this.measurePoints.clear();
                    MainActivity.this.distanceSum = Utils.DOUBLE_EPSILON;
                }
            }
        });
    }

    void switchPencilWindow(ImageView imageView) {
        if (this.pencilPopContentView == null) {
            View inflate = View.inflate(this, R.layout.tools_pencil_layout, null);
            this.pencilPopContentView = inflate;
            inflate.measure(0, 0);
        }
        if (this.pencilPopupWindow == null) {
            View view = this.pencilPopContentView;
            PopupWindow popupWindow = new PopupWindow(view, view.getMeasuredWidth() + TbsListener.ErrorCode.ERROR_CODE_LOAD_BASE, -2, true);
            this.pencilPopupWindow = popupWindow;
            this.popupWindows.add(popupWindow);
        }
        this.pencilPopupWindow.setOutsideTouchable(false);
        this.pencilPopupWindow.setFocusable(false);
        this.pencilPopupWindow.setBackgroundDrawable(new BitmapDrawable());
        PopupWindow popupWindow2 = this.pencilPopupWindow;
        popupWindow2.showAtLocation(imageView, 81, 0, popupWindow2.getContentView().getMeasuredHeight() + 100);
        final View findViewById = this.pencilPopContentView.findViewById(R.id.pencil_color);
        this.doodleView.setVisibility(0);
        this.seekBar = (SeekBar) this.pencilPopContentView.findViewById(R.id.pencil_seekBar);
        this.doodleView.mPaint.setStrokeWidth(this.seekBar.getProgress());
        this.doodleView.mPaint.setColor(((ColorDrawable) findViewById.getBackground()).getColor());
        this.seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.55
            @Override // android.widget.SeekBar.OnSeekBarChangeListener
            public void onProgressChanged(SeekBar seekBar, int i, boolean z) {
            }

            @Override // android.widget.SeekBar.OnSeekBarChangeListener
            public void onStartTrackingTouch(SeekBar seekBar) {
            }

            @Override // android.widget.SeekBar.OnSeekBarChangeListener
            public void onStopTrackingTouch(SeekBar seekBar) {
                MainActivity.this.doodleView.mPaint.setStrokeWidth(seekBar.getProgress());
            }
        });
        ((TextView) this.pencilPopContentView.findViewById(R.id.pencil_save)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.56
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
                if (MainActivity.this.pencilSaveContentView == null) {
                    MainActivity mainActivity = MainActivity.this;
                    mainActivity.pencilSaveContentView = View.inflate(mainActivity, R.layout.tools_popup_pencil, null);
                    MainActivity.this.pencilSaveContentView.measure(0, 0);
                }
                if (MainActivity.this.pencilSavePopupWindow == null) {
                    MainActivity.this.pencilSavePopupWindow = new PopupWindow(MainActivity.this.pencilSaveContentView, -2, -2, true);
                }
                MainActivity.this.pencilSavePopupWindow.setOutsideTouchable(false);
                MainActivity.this.pencilSavePopupWindow.setFocusable(true);
                MainActivity.this.pencilSavePopupWindow.setBackgroundDrawable(new BitmapDrawable());
                MainActivity.this.pencilSavePopupWindow.showAtLocation(MainActivity.this.map, 17, 0, 0);
                final EditText editText = (EditText) MainActivity.this.pencilSaveContentView.findViewById(R.id.popup_pencilName);
                editText.setText("");
                ((TextView) MainActivity.this.pencilSaveContentView.findViewById(R.id.popup_pencilClose)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.56.1
                    @Override // android.view.View.OnClickListener
                    public void onClick(View view3) {
                        MainActivity.this.pencilSavePopupWindow.dismiss();
                    }
                });
                ((TextView) MainActivity.this.pencilSaveContentView.findViewById(R.id.popup_pencilConfirm)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.56.2
                    @Override // android.view.View.OnClickListener
                    public void onClick(View view3) {
                        if (!MainActivity.this.isNull(SpUtils.get(MainActivity.this, "pencil_tag", "") + "")) {
                            Gson gson = new Gson();
                            MainActivity.this.pencilInfoArrayList.clear();
                            MainActivity.this.pencilInfoArrayList.addAll((ArrayList) gson.fromJson(SpUtils.get(MainActivity.this, "pencil_tag", "") + "", new TypeToken<List<PencilInfo>>() { // from class: com.gisocn.onemap.ui.activity.MainActivity.56.2.1
                            }.getType()));
                        }
                        if (MainActivity.this.doodleView.savePath.size() > 0) {
                            PencilInfo pencilInfo = new PencilInfo();
                            pencilInfo.setPencilTime(new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss").format(new Date(System.currentTimeMillis())));
                            if (editText.getText() != null) {
                                pencilInfo.setPencilName(MainActivity.this.getStr(editText));
                            } else {
                                pencilInfo.setPencilName("未命名");
                            }
                            pencilInfo.setPath(MainActivity.this.doodleView.saveBitmap());
                            pencilInfo.setPolygonStr(MainActivity.this.map.getExtent().toString());
                            Point center = MainActivity.this.map.getCenter();
                            double width = MainActivity.this.map.getWidth();
                            double resolution = MainActivity.this.map.getResolution();
                            Double.isNaN(width);
                            double d = width * resolution;
                            double width2 = MainActivity.this.map.getWidth();
                            double resolution2 = MainActivity.this.map.getResolution();
                            Double.isNaN(width2);
                            Envelope envelope = new Envelope(center, d, width2 * resolution2);
                            pencilInfo.setScale(MainActivity.this.map.getScale());
                            pencilInfo.setPolygon(envelope);
                            MainActivity.this.pencilInfoArrayList.add(pencilInfo);
                            SpUtils.put(MainActivity.this, "pencil_tag", new Gson().toJson(MainActivity.this.pencilInfoArrayList));
                            MainActivity.this.showToast("保存成功");
                            MainActivity.this.pencilSavePopupWindow.dismiss();
                            return;
                        }
                        MainActivity.this.showToast("请先涂鸦画图再进行保存操作");
                    }
                });
            }
        });
        ((TextView) this.pencilPopContentView.findViewById(R.id.pencil_open)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.57
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
                MainActivity.this.doodleView.canClear = false;
                if (MainActivity.this.pencilOpenContentView == null) {
                    MainActivity mainActivity = MainActivity.this;
                    mainActivity.pencilOpenContentView = View.inflate(mainActivity, R.layout.tools_pencil_save, null);
                    MainActivity.this.pencilOpenContentView.measure(0, 0);
                }
                if (MainActivity.this.pencilOpenPopupWindow == null) {
                    MainActivity.this.pencilOpenPopupWindow = new PopupWindow(MainActivity.this.pencilOpenContentView, -1, -1, true);
                    RecyclerView recyclerView = (RecyclerView) MainActivity.this.pencilOpenContentView.findViewById(R.id.pencil_recycle);
                    recyclerView.setLayoutManager(new LinearLayoutManager(MainActivity.this));
                    MainActivity mainActivity2 = MainActivity.this;
                    mainActivity2.pencilAdapter = new PencilAdapter(mainActivity2.pencilInfoArrayList);
                    recyclerView.setAdapter(MainActivity.this.pencilAdapter);
                    MainActivity mainActivity3 = MainActivity.this;
                    mainActivity3.savePathclose = (TextView) mainActivity3.pencilOpenContentView.findViewById(R.id.pencile_close);
                    MainActivity mainActivity4 = MainActivity.this;
                    mainActivity4.clear = (TextView) mainActivity4.pencilOpenContentView.findViewById(R.id.pencile_clear);
                }
                MainActivity mainActivity5 = MainActivity.this;
                if (!mainActivity5.isNull(SpUtils.get(MainActivity.this, "pencil_tag", "") + "")) {
                    Gson gson = new Gson();
                    MainActivity.this.pencilInfoArrayList.clear();
                    MainActivity.this.pencilInfoArrayList.addAll((ArrayList) gson.fromJson(SpUtils.get(MainActivity.this, "pencil_tag", "") + "", new TypeToken<List<PencilInfo>>() { // from class: com.gisocn.onemap.ui.activity.MainActivity.57.1
                    }.getType()));
                    MainActivity.this.pencilAdapter.notifyDataSetChanged();
                }
                MainActivity.this.pencilOpenPopupWindow.setOutsideTouchable(false);
                MainActivity.this.pencilOpenPopupWindow.setFocusable(true);
                MainActivity.this.pencilOpenPopupWindow.setBackgroundDrawable(new BitmapDrawable());
                MainActivity.this.pencilOpenPopupWindow.showAtLocation(MainActivity.this.map, 8388627, 200, 0);
                MainActivity.this.savePathclose.setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.57.2
                    @Override // android.view.View.OnClickListener
                    public void onClick(View view3) {
                        MainActivity.this.pencilOpenPopupWindow.dismiss();
                    }
                });
                MainActivity.this.clear.setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.57.3
                    @Override // android.view.View.OnClickListener
                    public void onClick(View view3) {
                        MainActivity.this.pencilInfoArrayList.clear();
                        SpUtils.put(MainActivity.this, "pencil_tag", new Gson().toJson(MainActivity.this.pencilInfoArrayList));
                        MainActivity.this.pencilAdapter.notifyDataSetChanged();
                    }
                });
                MainActivity.this.pencilAdapter.setOnItemClickListener(new OnItemClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.57.4
                    @Override // com.gisocn.onemap.interfaces.OnItemClickListener
                    public void onItemClick(View view3, int i, int i2) {
                    }

                    @Override // com.gisocn.onemap.interfaces.OnItemClickListener
                    public void onItemClick(View view3, int i) {
                        Message message = new Message();
                        message.what = 1111;
                        message.obj = MainActivity.this.pencilInfoArrayList.get(i);
                        MainActivity.this.handler.sendMessage(message);
                    }
                });
            }
        });
        ((TextView) this.pencilPopContentView.findViewById(R.id.pencil_doodle)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.58
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
                MainActivity.this.doodleView.setVisibility(0);
            }
        });
        findViewById.setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.59
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
                if (MainActivity.this.pencilColorContentView == null) {
                    MainActivity mainActivity = MainActivity.this;
                    mainActivity.pencilColorContentView = View.inflate(mainActivity, R.layout.tools_color, null);
                    MainActivity.this.pencilColorContentView.measure(0, 0);
                }
                if (MainActivity.this.pencilColorPopupWindow == null) {
                    MainActivity.this.pencilColorPopupWindow = new PopupWindow(MainActivity.this.pencilColorContentView, -2, -2, true);
                }
                MainActivity.this.pencilColorPopupWindow.setOutsideTouchable(true);
                MainActivity.this.pencilColorPopupWindow.setFocusable(true);
                MainActivity.this.pencilColorPopupWindow.setBackgroundDrawable(new BitmapDrawable());
                MainActivity.this.pencilColorPopupWindow.showAtLocation(MainActivity.this.map, 81, 0, MainActivity.this.pencilColorPopupWindow.getContentView().getMeasuredHeight() + 50);
                View findViewById2 = MainActivity.this.pencilColorContentView.findViewById(R.id.color_1);
                View findViewById3 = MainActivity.this.pencilColorContentView.findViewById(R.id.color_2);
                View findViewById4 = MainActivity.this.pencilColorContentView.findViewById(R.id.color_3);
                View findViewById5 = MainActivity.this.pencilColorContentView.findViewById(R.id.color_4);
                View findViewById6 = MainActivity.this.pencilColorContentView.findViewById(R.id.color_5);
                View findViewById7 = MainActivity.this.pencilColorContentView.findViewById(R.id.color_6);
                View findViewById8 = MainActivity.this.pencilColorContentView.findViewById(R.id.color_7);
                View findViewById9 = MainActivity.this.pencilColorContentView.findViewById(R.id.color_8);
                View findViewById10 = MainActivity.this.pencilColorContentView.findViewById(R.id.color_9);
                View findViewById11 = MainActivity.this.pencilColorContentView.findViewById(R.id.color_10);
                View findViewById12 = MainActivity.this.pencilColorContentView.findViewById(R.id.color_11);
                View findViewById13 = MainActivity.this.pencilColorContentView.findViewById(R.id.color_12);
                View findViewById14 = MainActivity.this.pencilColorContentView.findViewById(R.id.color_13);
                View findViewById15 = MainActivity.this.pencilColorContentView.findViewById(R.id.color_14);
                View findViewById16 = MainActivity.this.pencilColorContentView.findViewById(R.id.color_15);
                MainActivity.this.colors.add(findViewById2);
                MainActivity.this.colors.add(findViewById3);
                MainActivity.this.colors.add(findViewById4);
                MainActivity.this.colors.add(findViewById5);
                MainActivity.this.colors.add(findViewById6);
                MainActivity.this.colors.add(findViewById7);
                MainActivity.this.colors.add(findViewById8);
                MainActivity.this.colors.add(findViewById9);
                MainActivity.this.colors.add(findViewById10);
                MainActivity.this.colors.add(findViewById11);
                MainActivity.this.colors.add(findViewById12);
                MainActivity.this.colors.add(findViewById13);
                MainActivity.this.colors.add(findViewById14);
                MainActivity.this.colors.add(findViewById15);
                MainActivity.this.colors.add(findViewById16);
                MainActivity mainActivity2 = MainActivity.this;
                mainActivity2.colorViewClick(mainActivity2.colors, findViewById);
            }
        });
        ((TextView) this.pencilPopContentView.findViewById(R.id.pencil_cancel)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.60
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
                MainActivity.this.doodleView.undo();
                if (MainActivity.this.seekBar.getProgress() != 0) {
                    MainActivity.this.doodleView.mPaint.setStrokeWidth(MainActivity.this.seekBar.getProgress());
                } else {
                    MainActivity.this.doodleView.mPaint.setStrokeWidth(10.0f);
                }
            }
        });
        ((TextView) this.pencilPopContentView.findViewById(R.id.pencil_recovery)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.61
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
                MainActivity.this.doodleView.redo();
            }
        });
        ((TextView) this.pencilPopContentView.findViewById(R.id.pencil_clean)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.62
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
                if (MainActivity.this.doodleView.canClear) {
                    MainActivity.this.doodleView.removeAllPaint();
                    MainActivity.this.seekBar.setProgress(0);
                    MainActivity.this.doodleView.mPaint.setStrokeWidth(10.0f);
                }
            }
        });
        ((TextView) this.pencilPopContentView.findViewById(R.id.pencil_screenshots)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.63
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
                if (Build.VERSION.SDK_INT >= 21) {
                    MainActivity mainActivity = MainActivity.this;
                    mainActivity.mImageReader = ImageReader.newInstance(mainActivity.width, MainActivity.this.height, 1, 1);
                    MainActivity mainActivity2 = MainActivity.this;
                    mainActivity2.mediaProjectionManager = (MediaProjectionManager) mainActivity2.getSystemService("media_projection");
                    MainActivity mainActivity3 = MainActivity.this;
                    mainActivity3.startActivityForResult(mainActivity3.mediaProjectionManager.createScreenCaptureIntent(), 102);
                    return;
                }
                MainActivity.this.showToast("版本过低,无法截屏");
            }
        });
        ((TextView) this.pencilPopContentView.findViewById(R.id.close)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.64
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
                MainActivity.this.pencilPopupWindow.dismiss();
                MainActivity.this.leftTools.setVisibility(0);
                MainActivity.this.doodleView.setVisibility(8);
                MainActivity.this.doodleView.removeAllPaint();
            }
        });
    }

    public void setOpacity(ArrayList<String> arrayList, float f) {
        Layer[] layers;
        Iterator<String> it = arrayList.iterator();
        while (it.hasNext()) {
            String next = it.next();
            for (Layer layer : this.map.getLayers()) {
                if (next.equals(layer.getName())) {
                    layer.setOpacity(f);
                }
            }
        }
    }

    void colorViewClick(ArrayList<View> arrayList, final View view) {
        for (int i = 0; i < arrayList.size(); i++) {
            arrayList.get(i).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.65
                @Override // android.view.View.OnClickListener
                public void onClick(View view2) {
                    ColorDrawable colorDrawable = (ColorDrawable) view2.getBackground();
                    MainActivity.this.doodleView.mPaint.setColor(colorDrawable.getColor());
                    MainActivity.this.pencilColorPopupWindow.dismiss();
                    view.setBackgroundColor(colorDrawable.getColor());
                }
            });
        }
    }

    public static void saveImageToGallery(Activity activity, Bitmap bitmap) {
        File file;
        File file2 = new File(Environment.getExternalStorageDirectory() + File.separator + Environment.DIRECTORY_DCIM + File.separator + "Camera" + File.separator);
        if (!file2.exists()) {
            file2.mkdir();
        }
        String str = System.currentTimeMillis() + ".jpg";
        try {
            FileOutputStream fileOutputStream = new FileOutputStream(new File(file2, str));
            bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
            fileOutputStream.flush();
            fileOutputStream.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e2) {
            e2.printStackTrace();
        }
        MediaStore.Images.Media.insertImage(activity.getContentResolver(), bitmap, str, (String) null);
        bitmap.recycle();
        Log.e("getAbsolutePath", "" + file.getAbsolutePath());
        Log.e("fileName", str);
        activity.sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.parse("file://" + Environment.getExternalStorageDirectory().getPath())));
    }

    public void showIntroduction(String str, View view) {
        if (this.introducitonContentView == null) {
            View inflate = View.inflate(this, R.layout.popup_introduction, null);
            this.introducitonContentView = inflate;
            inflate.measure(0, 0);
        }
        if (this.introducitonPopupWindow == null) {
            PopupWindow popupWindow = new PopupWindow(this.introducitonContentView, -2, -2, true);
            this.introducitonPopupWindow = popupWindow;
            this.popupWindows.add(popupWindow);
        }
        this.introducitonPopupWindow.setOutsideTouchable(true);
        this.introducitonPopupWindow.setBackgroundDrawable(new BitmapDrawable());
        this.introducitonPopupWindow.showAtLocation(view, 51, this.params.width + this.leftTools.getWidth() + 10, 0);
        ((TextView) this.introducitonContentView.findViewById(R.id.tv_introduciton)).setText(str);
    }

    void switchMapPopupWindow(ImageView imageView) {
        if (this.earthPopContentView == null) {
            View inflate = View.inflate(this, R.layout.popup_switch_map, null);
            this.earthPopContentView = inflate;
            inflate.measure(0, 0);
        }
        if (this.earthPopupWindow == null) {
            PopupWindow popupWindow = new PopupWindow(this.earthPopContentView, -2, -2, true);
            this.earthPopupWindow = popupWindow;
            this.popupWindows.add(popupWindow);
        }
        this.earthPopupWindow.setOutsideTouchable(true);
        this.earthPopupWindow.setBackgroundDrawable(new BitmapDrawable());
        PopupWindow popupWindow2 = this.earthPopupWindow;
        popupWindow2.showAsDropDown(imageView, -popupWindow2.getContentView().getMeasuredWidth(), -((this.earthPopupWindow.getContentView().getMeasuredHeight() / 2) + (imageView.getHeight() / 2)));
        LinearLayout linearLayout = (LinearLayout) this.earthPopContentView.findViewById(R.id.ll_vec);
        this.vector = (TextView) this.earthPopContentView.findViewById(R.id.vector);
        this.image = (TextView) this.earthPopContentView.findViewById(R.id.image);
        final ArrayList arrayList = new ArrayList();
        for (Layer layer : this.map.getLayers()) {
            arrayList.add(layer.getName());
        }
        linearLayout.setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.66
            @Override // android.view.View.OnClickListener
            public void onClick(View view) {
                Layer[] layers;
                MainActivity.this.isImageMap = false;
                MainActivity.this.vector.setBackgroundColor(ContextCompat.getColor(MainActivity.this, R.color.colorPrimary));
                MainActivity.this.image.setBackgroundColor(ContextCompat.getColor(MainActivity.this, R.color.colorGray));
                if (arrayList.contains("VEC_C")) {
                    for (Layer layer2 : MainActivity.this.map.getLayers()) {
                        if ("VEC_C".equals(layer2.getName()) || "CVA_C".equals(layer2.getName())) {
                            layer2.setVisible(true);
                        } else if ("IMG_C".equals(layer2.getName()) || "CIA_C".equals(layer2.getName())) {
                            layer2.setVisible(false);
                        }
                    }
                } else {
                    MainActivity.this.initBaseMap(0, true);
                }
                MainActivity.this.earthPopupWindow.dismiss();
            }
        });
        ((LinearLayout) this.earthPopContentView.findViewById(R.id.ll_image)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.67
            @Override // android.view.View.OnClickListener
            public void onClick(View view) {
                Layer[] layers;
                MainActivity.this.isImageMap = true;
                MainActivity.this.vector.setBackgroundColor(ContextCompat.getColor(MainActivity.this, R.color.colorGray));
                MainActivity.this.image.setBackgroundColor(ContextCompat.getColor(MainActivity.this, R.color.colorPrimary));
                if (arrayList.contains("IMG_C")) {
                    for (Layer layer2 : MainActivity.this.map.getLayers()) {
                        if ("IMG_C".equals(layer2.getName()) || "CIA_C".equals(layer2.getName())) {
                            layer2.setVisible(true);
                        } else if ("VEC_C".equals(layer2.getName())) {
                            layer2.setVisible(false);
                        } else if ("CVA_C".equals(layer2.getName())) {
                            layer2.setVisible(false);
                        }
                    }
                } else {
                    MainActivity.this.initBaseMap(1, true);
                    MainActivity.this.vector.setBackgroundColor(ContextCompat.getColor(MainActivity.this, R.color.colorPrimary));
                    MainActivity.this.image.setBackgroundColor(ContextCompat.getColor(MainActivity.this, R.color.colorGray));
                }
                MainActivity.this.earthPopupWindow.dismiss();
            }
        });
    }

    void toDCIM(Activity activity, Bitmap bitmap, String str) {
        File file = new File(Environment.getExternalStorageDirectory() + File.separator + Environment.DIRECTORY_DCIM + File.separator + "Camera" + File.separator);
        if (!file.exists()) {
            file.mkdir();
        }
        String str2 = str + ".jpg";
        try {
            FileOutputStream fileOutputStream = new FileOutputStream(new File(file, str2));
            bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
            fileOutputStream.flush();
            fileOutputStream.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e2) {
            e2.printStackTrace();
        }
        MediaStore.Images.Media.insertImage(activity.getContentResolver(), bitmap, str2, (String) null);
        bitmap.recycle();
        showToast("图片已保存至相册");
        activity.sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.parse("file://" + Environment.getExternalStorageDirectory().getPath())));
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onMessageEvent(MessageEvent messageEvent) {
        if (Constant.MESSAGE_EVENT_UPDATA_PHOTO.equals(messageEvent.eventType)) {
            L.e("MAIN_MESSAGE_EVENT_UPDATA_PHOTO");
            if (this.photoPopupWindow != null) {
                this.photoLocation.setVisibility(8);
                this.photoTools.setVisibility(8);
                this.photorecyclerView.setVisibility(0);
                this.bigImage.setVisibility(8);
                this.bigPhotoName.setVisibility(8);
                if (isNull(SpUtils.get(this, "photo_tag", "") + "")) {
                    return;
                }
                Gson gson = new Gson();
                this.photoInfoArrayList.clear();
                this.photoInfoArrayList.addAll((ArrayList) gson.fromJson(SpUtils.get(this, "photo_tag", "") + "", new TypeToken<List<PhotoInfo>>() { // from class: com.gisocn.onemap.ui.activity.MainActivity.68
                }.getType()));
                this.adapter.notifyDataSetChanged();
            }
        }
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
    public void onStop() {
        super.onStop();
        AMapLocationClient aMapLocationClient = this.mlocationClient;
        if (aMapLocationClient != null) {
            aMapLocationClient.stopLocation();
        }
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // com.gisocn.onemap.base.BaseActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
    public void onDestroy() {
        super.onDestroy();
        this.handler.removeCallbacksAndMessages(null);
        AMapLocationClient aMapLocationClient = this.mlocationClient;
        if (aMapLocationClient != null) {
            aMapLocationClient.onDestroy();
        }
        EventBus.getDefault().unregister(this);
    }

    public void handPaintLayer(Geometry geometry) {
        SimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol(ContextCompat.getColor(this, R.color.colorGreen));
        simpleFillSymbol.setOutline(new SimpleLineSymbol(-16777216, 1.0f));
        if (this.handPaintLayer == null) {
            this.handPaintLayer = new GraphicsLayer();
        }
        this.handPaintLayer.removeAll();
        if (!mapContains(this.handPaintLayer)) {
            this.handPaintLayer.setName("handPaint");
            this.map.addLayer(this.handPaintLayer);
        }
        this.handPaintLayer.addGraphic(new Graphic(geometry, simpleFillSymbol));
    }

    public void removethandPaintLayer() {
        GraphicsLayer graphicsLayer = this.handPaintLayer;
        if (graphicsLayer != null) {
            graphicsLayer.removeAll();
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public void measureDistance(float f, float f2) {
        double d;
        ArrayList<Point> arrayList;
        ArrayList<Point> arrayList2;
        SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(-16711936, 7, SimpleMarkerSymbol.STYLE.CIRCLE);
        simpleMarkerSymbol.setOutline(new SimpleLineSymbol(-16777216, 1.0f));
        SimpleLineSymbol simpleLineSymbol = new SimpleLineSymbol(SupportMenu.CATEGORY_MASK, 3.0f);
        this.measurePoints.add(this.map.toMapPoint(f, f2));
        if (this.handPaintLayer == null) {
            this.handPaintLayer = new GraphicsLayer();
        }
        this.handPaintLayer.setName("handPaint");
        if (!mapContains(this.handPaintLayer)) {
            this.map.addLayer(this.handPaintLayer);
        }
        this.handPaintLayer.addGraphic(new Graphic(this.map.toMapPoint(f, f2), simpleMarkerSymbol));
        Polyline polyline = new Polyline();
        if (this.measurePoints.size() > 1) {
            for (int i = 0; i < this.measurePoints.size(); i++) {
                if (i == 0) {
                    polyline.startPath(this.measurePoints.get(i));
                } else {
                    polyline.lineTo(this.measurePoints.get(i));
                }
            }
            this.handPaintLayer.addGraphic(new Graphic(polyline, simpleLineSymbol));
            ArrayList<Point> arrayList3 = this.measurePoints;
            Point point = arrayList3.get(arrayList3.size() - 1);
            Point point2 = this.measurePoints.get(arrayList.size() - 2);
            if (Constant.WKID != SpatialReference.WKID_WGS84) {
                ArrayList<Point> arrayList4 = this.measurePoints;
                point = (Point) GeometryEngine.project(arrayList4.get(arrayList4.size() - 1), SpatialReference.create(Constant.WKID), SpatialReference.create(SpatialReference.WKID_WGS84));
                point2 = (Point) GeometryEngine.project(this.measurePoints.get(arrayList2.size() - 2), SpatialReference.create(Constant.WKID), SpatialReference.create(SpatialReference.WKID_WGS84));
            }
            d = GeometryEngine.geodesicDistance(point, point2, SpatialReference.create(SpatialReference.WKID_WGS84), null);
            this.distanceSum += d;
            Log.e("距离:", "" + d);
        } else {
            d = Utils.DOUBLE_EPSILON;
        }
        this.tv_data.setText("全长:" + String.format("%.1f", Double.valueOf(this.distanceSum)) + "米 最后一段长:" + String.format("%.1f", Double.valueOf(d)) + "米");
    }

    /* JADX INFO: Access modifiers changed from: private */
    public void measureArea(float f, float f2) {
        double d;
        SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(-16711936, 7, SimpleMarkerSymbol.STYLE.CIRCLE);
        simpleMarkerSymbol.setOutline(new SimpleLineSymbol(-16777216, 1.0f));
        SimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol(ContextCompat.getColor(this, R.color.colorGreen));
        simpleFillSymbol.setOutline(new SimpleLineSymbol(SupportMenu.CATEGORY_MASK, 1.0f));
        this.measurePoints.add(this.map.toMapPoint(f, f2));
        GraphicsLayer graphicsLayer = this.handPaintLayer;
        if (graphicsLayer != null) {
            graphicsLayer.removeAll();
        } else {
            this.handPaintLayer = new GraphicsLayer();
        }
        this.handPaintLayer.setName("handPaint");
        if (!mapContains(this.handPaintLayer)) {
            this.map.addLayer(this.handPaintLayer);
        }
        Iterator<Point> it = this.measurePoints.iterator();
        while (it.hasNext()) {
            this.handPaintLayer.addGraphic(new Graphic(it.next(), simpleMarkerSymbol));
        }
        Polygon polygon = new Polygon();
        if (this.measurePoints.size() > 1) {
            for (int i = 0; i < this.measurePoints.size(); i++) {
                if (i == 0) {
                    polygon.startPath(this.measurePoints.get(i));
                } else {
                    polygon.lineTo(this.measurePoints.get(i));
                }
            }
            this.handPaintLayer.addGraphic(new Graphic(polygon, simpleFillSymbol));
            d = GeometryEngine.geodesicArea(polygon, this.map.getSpatialReference(), null) / 1000000.0d;
            Log.e("面积:", "" + d);
        } else {
            d = Utils.DOUBLE_EPSILON;
        }
        TextView textView = this.tv_data;
        textView.setText("面积=" + String.format("%.3f", Double.valueOf(d)) + "平方公里=" + String.format("%.3f", Double.valueOf(d * 1500.0d)) + "亩");
    }

    public void loadGeometry(List<Geometry> list, String str) {
        GraphicsLayer graphicsLayer = this.handPaintLayer;
        if (graphicsLayer != null) {
            graphicsLayer.removeAll();
        }
        final SimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol(ContextCompat.getColor(this, R.color.colorHightGreenBg));
        simpleFillSymbol.setOutline(new SimpleLineSymbol(ContextCompat.getColor(this, R.color.colorHightGreen), 1.0f));
        GraphicsLayer graphicsLayer2 = this.graphicsLayer;
        if (graphicsLayer2 != null) {
            if (mapContains(graphicsLayer2)) {
                this.map.addLayer(this.graphicsLayer);
            }
        } else {
            this.graphicsLayer = new GraphicsLayer();
        }
        this.graphicsLayer.removeAll();
        this.graphicsLayer.setName(str);
        this.map.addLayer(this.graphicsLayer);
        final Geometry[] geometryArr = (Geometry[]) list.toArray(new Geometry[list.size()]);
        ExecutorsManager.getInstance().execute(new Runnable() { // from class: com.gisocn.onemap.ui.activity.MainActivity.69
            @Override // java.lang.Runnable
            public void run() {
                Graphic graphic = new Graphic(GeometryEngine.union(geometryArr, MainActivity.this.map.getSpatialReference()), simpleFillSymbol);
                Message message = new Message();
                message.obj = graphic;
                message.what = 1007;
                MainActivity.this.handler.sendMessage(message);
            }
        });
    }

    public void loadGeometry(Geometry geometry, String str) {
        GraphicsLayer graphicsLayer = this.handPaintLayer;
        if (graphicsLayer != null) {
            graphicsLayer.removeAll();
        }
        SimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol(ContextCompat.getColor(this, R.color.colorHightGreenBg));
        simpleFillSymbol.setOutline(new SimpleLineSymbol(ContextCompat.getColor(this, R.color.colorHightGreen), 3.0f));
        this.graphicsLayer.removeAll();
        this.graphicsLayer.setName(str);
        if (!mapContains(this.graphicsLayer)) {
            this.map.addLayer(this.graphicsLayer);
        }
        this.graphicsLayer.addGraphic(new Graphic(geometry, simpleFillSymbol));
    }

    public void loadGeometry(Geometry geometry, String str, int i) {
        Symbol simpleMarkerSymbol;
        L.e("loadGeometry" + i);
        if (geometry != null && i == 2) {
            GraphicsLayer graphicsLayer = this.highLightLayer;
            if (graphicsLayer != null) {
                if (mapContains(graphicsLayer)) {
                    this.map.removeLayer(this.highLightLayer);
                }
                this.highLightLayer.removeAll();
            } else {
                this.highLightLayer = new GraphicsLayer();
            }
            this.highLightLayer.removeAll();
            this.highLightLayer = null;
            GraphicsLayer graphicsLayer2 = new GraphicsLayer();
            this.highLightLayer = graphicsLayer2;
            graphicsLayer2.setName(str);
            this.map.addLayer(this.highLightLayer);
            L.e("geometry.getType()" + geometry.getType());
            int i2 = AnonymousClass76.$SwitchMap$com$esri$core$geometry$Geometry$Type[geometry.getType().ordinal()];
            if (i2 == 1) {
                simpleMarkerSymbol = new SimpleMarkerSymbol(ContextCompat.getColor(this, R.color.colorBlue), 20, SimpleMarkerSymbol.STYLE.CIRCLE);
                ((SimpleMarkerSymbol) simpleMarkerSymbol).setOutline(new SimpleLineSymbol(SupportMenu.CATEGORY_MASK, 2.0f));
            } else if (i2 == 2 || i2 == 3) {
                simpleMarkerSymbol = new SimpleLineSymbol(R.color.colorBlue, 3.0f);
            } else {
                simpleMarkerSymbol = new SimpleFillSymbol(ContextCompat.getColor(this, R.color.colorTransparent));
                ((SimpleFillSymbol) simpleMarkerSymbol).setOutline(new SimpleLineSymbol(ContextCompat.getColor(this, R.color.colorRed), 5.0f));
            }
            this.highLightLayer.addGraphic(new Graphic(geometry, simpleMarkerSymbol));
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* renamed from: com.gisocn.onemap.ui.activity.MainActivity$76  reason: invalid class name */
    /* loaded from: classes2.dex */
    public static /* synthetic */ class AnonymousClass76 {
        static final /* synthetic */ int[] $SwitchMap$com$esri$core$geometry$Geometry$Type;

        static {
            int[] iArr = new int[Geometry.Type.values().length];
            $SwitchMap$com$esri$core$geometry$Geometry$Type = iArr;
            try {
                iArr[Geometry.Type.POINT.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                $SwitchMap$com$esri$core$geometry$Geometry$Type[Geometry.Type.POLYLINE.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                $SwitchMap$com$esri$core$geometry$Geometry$Type[Geometry.Type.LINE.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
        }
    }

    public void loadGeometry(Point point, String str, String str2) {
        this.markGeometry = point;
        this.photoUrl = str2;
        GraphicsLayer graphicsLayer = this.handPaintLayer;
        if (graphicsLayer != null) {
            graphicsLayer.removeAll();
        }
        PictureMarkerSymbol pictureMarkerSymbol = new PictureMarkerSymbol(getResources().getDrawable(R.drawable.icon_position));
        this.graphicsLayer.removeAll();
        this.graphicsLayer.setName(str);
        if (!mapContains(this.graphicsLayer)) {
            this.map.addLayer(this.graphicsLayer);
        }
        this.graphicsLayer.addGraphic(new Graphic(point, pictureMarkerSymbol));
    }

    public void loadGeometryLocal(Point point, String str) {
        this.markGeometry = point;
        GraphicsLayer graphicsLayer = this.handPaintLayer;
        if (graphicsLayer != null) {
            graphicsLayer.removeAll();
        }
        PictureMarkerSymbol pictureMarkerSymbol = new PictureMarkerSymbol(getResources().getDrawable(R.drawable.icon_position));
        StringBuilder sb = new StringBuilder();
        sb.append("graphicsLayer == null");
        sb.append(this.graphicsLayer == null);
        L.e(sb.toString());
        GraphicsLayer graphicsLayer2 = this.graphicsLayer;
        if (graphicsLayer2 == null) {
            this.graphicsLayer = new GraphicsLayer();
        } else {
            if (mapContains(graphicsLayer2)) {
                this.map.removeLayer(this.graphicsLayer);
            }
            this.graphicsLayer.removeAll();
            this.graphicsLayer = null;
            this.graphicsLayer = new GraphicsLayer();
        }
        this.graphicsLayer.setName(str);
        this.graphicsLayer.setVisible(true);
        this.graphicsLayer.addGraphic(new Graphic(point, pictureMarkerSymbol));
        this.map.addLayer(this.graphicsLayer);
    }

    public void loadGeometryAndFlicker(Geometry geometry, String str, int i) {
        Symbol simpleMarkerSymbol;
        int i2 = 0;
        while (true) {
            if (i2 >= this.map.getLayers().length) {
                break;
            }
            L.e("删除地图图层" + this.map.getLayer(i2).getName());
            if ((this.map.getLayers()[i2] instanceof GraphicsLayer) && this.map.getLayers()[i2].getName().equals("定位")) {
                ((GraphicsLayer) this.map.getLayers()[i2]).removeAll();
                this.map.removeLayer(i2);
                break;
            }
            i2++;
        }
        L.e("loadGeometry" + i);
        if (geometry != null && i == 2) {
            GraphicsLayer graphicsLayer = this.highLightLayer;
            if (graphicsLayer != null) {
                if (mapContains(graphicsLayer)) {
                    this.map.removeLayer(this.highLightLayer);
                }
                this.highLightLayer.removeAll();
            } else {
                this.highLightLayer = new GraphicsLayer();
            }
            this.highLightLayer.removeAll();
            this.highLightLayer = null;
            GraphicsLayer graphicsLayer2 = new GraphicsLayer();
            this.highLightLayer = graphicsLayer2;
            graphicsLayer2.setName(str);
            this.map.addLayer(this.highLightLayer);
            L.e("geometry.getType()" + geometry.getType());
            int i3 = AnonymousClass76.$SwitchMap$com$esri$core$geometry$Geometry$Type[geometry.getType().ordinal()];
            if (i3 == 1) {
                simpleMarkerSymbol = new SimpleMarkerSymbol(ContextCompat.getColor(this, R.color.colorBlue), 20, SimpleMarkerSymbol.STYLE.CIRCLE);
                ((SimpleMarkerSymbol) simpleMarkerSymbol).setOutline(new SimpleLineSymbol(SupportMenu.CATEGORY_MASK, 2.0f));
            } else if (i3 == 2 || i3 == 3) {
                simpleMarkerSymbol = new SimpleLineSymbol(R.color.colorBlue, 3.0f);
            } else {
                simpleMarkerSymbol = new SimpleFillSymbol(ContextCompat.getColor(this, R.color.colorBlue));
                ((SimpleFillSymbol) simpleMarkerSymbol).setOutline(new SimpleLineSymbol(ContextCompat.getColor(this, R.color.colorRed), 5.0f));
            }
            L.e("symbol==nullfalse");
            this.highLightLayer.addGraphic(new Graphic(geometry, simpleMarkerSymbol));
            this.map.getScale();
            this.map.setExtent(geometry);
            this.flicker = 0;
            Timer timer = this.timer;
            if (timer != null) {
                timer.cancel();
            }
            Timer timer2 = new Timer();
            this.timer = timer2;
            timer2.schedule(new TimerTask() { // from class: com.gisocn.onemap.ui.activity.MainActivity.70
                @Override // java.util.TimerTask, java.lang.Runnable
                public void run() {
                    if (MainActivity.this.highLightLayer != null) {
                        MainActivity.this.highLightLayer.setVisible(MainActivity.this.flicker % 2 == 0);
                    }
                    MainActivity.this.flicker++;
                    if (MainActivity.this.flicker == 6) {
                        MainActivity.this.timer.cancel();
                        if (MainActivity.this.highLightLayer != null) {
                            MainActivity.this.highLightLayer.setVisible(false);
                        }
                    }
                }
            }, 0L, 500L);
        }
    }

    public void disMissAllPopupWindow() {
        Iterator<PopupWindow> it = this.popupWindows.iterator();
        while (it.hasNext()) {
            PopupWindow next = it.next();
            if (next != null) {
                next.dismiss();
            }
        }
    }

    public void closeStatistic() {
        this.llStatistic.setVisibility(8);
        if (this.statisticsList.size() > 0) {
            this.statisticsList.clear();
        }
        this.statisticAdapter.notifyDataSetChanged();
    }

    public void showStatistic(List<Statistic> list, String str, String str2) {
        int i = 0;
        this.llStatistic.setVisibility(0);
        if (!TextUtils.isEmpty(str)) {
            this.tvStatisticYdxz.setText(str);
        }
        if (!TextUtils.isEmpty(str2)) {
            this.tvStatisticArea.setText(str2);
        }
        double d = Utils.DOUBLE_EPSILON;
        if (this.statisticsList.size() > 0) {
            this.statisticsList.clear();
        }
        if (list != null) {
            this.statisticsList.addAll(list);
            for (Statistic statistic : list) {
                i += Integer.parseInt(statistic.getCount());
                d += Double.parseDouble(statistic.getArea());
            }
        }
        TextView textView = this.tvTotalCount;
        textView.setText(i + "个");
        DecimalFormat decimalFormat = new DecimalFormat("0.00");
        TextView textView2 = this.tvTotalArea;
        textView2.setText("" + decimalFormat.format(d));
        this.statisticAdapter.notifyDataSetChanged();
        initPieChart();
    }

    private void initPieChart() {
        this.llStatistic.setVisibility(0);
        ArrayList<Statistic> arrayList = new ArrayList<>();
        Iterator<Statistic> it = this.statisticsList.iterator();
        while (it.hasNext()) {
            Statistic next = it.next();
            if (Double.parseDouble(next.getArea()) != Utils.DOUBLE_EPSILON) {
                arrayList.add(next);
            }
        }
        setStaticsData(arrayList, 5.0f);
        this.pieChart.setUsePercentValues(true);
        this.pieChart.getDescription().setEnabled(false);
        this.pieChart.setExtraOffsets(10.0f, 10.0f, 10.0f, 10.0f);
        this.pieChart.setDragDecelerationFrictionCoef(0.95f);
        this.pieChart.setRotationAngle(0.0f);
        this.pieChart.setRotationEnabled(true);
        this.pieChart.setHighlightPerTapEnabled(true);
        this.pieChart.animateY(1400);
        this.pieChart.setDrawEntryLabels(false);
        this.pieChart.setEntryLabelColor(-1);
        this.pieChart.setEntryLabelTextSize(10.0f);
        this.pieChart.setDrawHoleEnabled(false);
        this.pieChart.setHoleRadius(0.0f);
        this.pieChart.setTransparentCircleRadius(0.0f);
        this.pieChart.setTransparentCircleColor(-16777216);
        this.pieChart.setTransparentCircleAlpha(150);
        this.pieChart.setHoleColor(-16777216);
        this.pieChart.setDrawCenterText(false);
        this.pieChart.setCenterText("测试");
        this.pieChart.setCenterTextSize(10.0f);
        this.pieChart.setCenterTextColor(SupportMenu.CATEGORY_MASK);
        Legend legend = this.pieChart.getLegend();
        legend.setEnabled(false);
        legend.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
        legend.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
        legend.setOrientation(Legend.LegendOrientation.VERTICAL);
        legend.setForm(Legend.LegendForm.DEFAULT);
        legend.setFormSize(10.0f);
        legend.setFormToTextSpace(10.0f);
        legend.setDrawInside(false);
        legend.setWordWrapEnabled(true);
        legend.setXEntrySpace(10.0f);
        legend.setYEntrySpace(8.0f);
        legend.setYOffset(0.0f);
        legend.setTextSize(14.0f);
        legend.setTextColor(Color.parseColor("#ff9933"));
        this.pieChart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.71
            @Override // com.github.mikephil.charting.listener.OnChartValueSelectedListener
            public void onNothingSelected() {
            }

            @Override // com.github.mikephil.charting.listener.OnChartValueSelectedListener
            public void onValueSelected(Entry entry, Highlight highlight) {
                PieEntry pieEntry = (PieEntry) entry;
                Log.e("getValue", "" + pieEntry.getValue());
                Log.e("getLabel", "" + pieEntry.getLabel());
                Log.e("onValueSelected", "-->value" + pieEntry.getValue() + "->x" + pieEntry.getX() + "->y" + pieEntry.getY());
            }
        });
        CustomMarkerView customMarkerView = new CustomMarkerView(this, R.layout.piechart_markerview, 0, null);
        customMarkerView.setChartView(this.pieChart);
        this.pieChart.setMarker(customMarkerView);
    }

    void initBarChart() {
        this.barChart.setDrawGridBackground(false);
        this.barChart.setDrawBarShadow(false);
        this.barChart.setHighlightFullBarEnabled(false);
        this.barChart.setDrawBorders(false);
        this.barChart.setDoubleTapToZoomEnabled(false);
        this.barChart.setHighlightPerDragEnabled(false);
        this.barChart.setDragDecelerationEnabled(true);
        XAxis xAxis = this.barChart.getXAxis();
        xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
        YAxis axisLeft = this.barChart.getAxisLeft();
        YAxis axisRight = this.barChart.getAxisRight();
        this.barChart.setDrawBorders(false);
        Description description = new Description();
        description.setEnabled(false);
        this.barChart.setDescription(description);
        xAxis.setDrawAxisLine(false);
        axisRight.setDrawAxisLine(false);
        axisLeft.setEnabled(false);
        xAxis.setDrawGridLines(false);
        xAxis.setDrawGridLines(false);
        xAxis.setCenterAxisLabels(true);
        xAxis.setTextSize(6.0f);
        Legend legend = this.barChart.getLegend();
        legend.setForm(Legend.LegendForm.LINE);
        legend.setTextSize(11.0f);
        legend.setEnabled(false);
        legend.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
        legend.setHorizontalAlignment(Legend.LegendHorizontalAlignment.LEFT);
        legend.setOrientation(Legend.LegendOrientation.HORIZONTAL);
        legend.setDrawInside(false);
        final ArrayList<Statistic> arrayList = new ArrayList<>();
        Iterator<Statistic> it = this.statisticsList.iterator();
        while (it.hasNext()) {
            Statistic next = it.next();
            if (Double.parseDouble(next.getArea()) != Utils.DOUBLE_EPSILON) {
                arrayList.add(next);
            }
        }
        CustomMarkerView customMarkerView = new CustomMarkerView(this, R.layout.piechart_markerview, 1, arrayList);
        customMarkerView.setChartView(this.barChart);
        this.barChart.setMarker(customMarkerView);
        xAxis.setAvoidFirstLastClipping(false);
        xAxis.setLabelCount(arrayList.size());
        xAxis.setLabelRotationAngle(30.0f);
        setBarData(arrayList);
        xAxis.setValueFormatter(new IAxisValueFormatter() { // from class: com.gisocn.onemap.ui.activity.MainActivity.72
            @Override // com.github.mikephil.charting.formatter.IAxisValueFormatter
            public String getFormattedValue(float f, AxisBase axisBase) {
                Log.e("getFormattedValue", "" + f);
                if (f >= 0.0f) {
                    ArrayList arrayList2 = arrayList;
                    return ((Statistic) arrayList2.get(((int) f) % arrayList2.size())).getName();
                }
                return "";
            }
        });
    }

    public void setBarData(ArrayList<Statistic> arrayList) {
        for (int i = 0; i < arrayList.size() && i < 48; i++) {
            Double.parseDouble(arrayList.get(i).getArea());
        }
        ArrayList arrayList2 = new ArrayList();
        if (arrayList.size() > 48) {
            for (int i2 = 0; i2 < 48; i2++) {
                arrayList2.add(new BarEntry(i2 * 1.0f, Float.valueOf(arrayList.get(i2).getArea()).floatValue()));
            }
        } else {
            for (int i3 = 0; i3 < arrayList.size(); i3++) {
                arrayList2.add(new BarEntry(i3 * 1.0f, Float.valueOf(arrayList.get(i3).getArea()).floatValue()));
            }
        }
        ArrayList arrayList3 = new ArrayList();
        for (int i4 : ColorTemplate.VORDIPLOM_COLORS) {
            arrayList3.add(Integer.valueOf(i4));
        }
        for (int i5 : ColorTemplate.JOYFUL_COLORS) {
            arrayList3.add(Integer.valueOf(i5));
        }
        for (int i6 : ColorTemplate.COLORFUL_COLORS) {
            arrayList3.add(Integer.valueOf(i6));
        }
        for (int i7 : ColorTemplate.LIBERTY_COLORS) {
            arrayList3.add(Integer.valueOf(i7));
        }
        for (int i8 : ColorTemplate.PASTEL_COLORS) {
            arrayList3.add(Integer.valueOf(i8));
        }
        arrayList3.add(Integer.valueOf(ColorTemplate.getHoloBlue()));
        BarDataSet barDataSet = new BarDataSet(arrayList2, "面积");
        barDataSet.setColors(arrayList3);
        barDataSet.setDrawValues(false);
        barDataSet.setBarShadowColor(-7829368);
        ArrayList arrayList4 = new ArrayList();
        arrayList4.add(barDataSet);
        BarData barData = new BarData(arrayList4);
        barData.setBarWidth(1.0f);
        this.barChart.setData(barData);
        this.barChart.setVisibleXRangeMaximum(10.0f);
    }

    private void setStaticsData(ArrayList<Statistic> arrayList, float f) {
        ArrayList arrayList2 = new ArrayList();
        double d = Utils.DOUBLE_EPSILON;
        for (int i = 0; i < arrayList.size() && i < 48; i++) {
            d += Double.parseDouble(arrayList.get(i).getArea());
        }
        if (arrayList.size() > 48) {
            for (int i2 = 0; i2 < 48; i2++) {
                arrayList2.add(new PieEntry((float) ((Double.valueOf(arrayList.get(i2).getArea()).doubleValue() / d) * 100.0d), arrayList.get(i2).getName()));
            }
        } else {
            for (int i3 = 0; i3 < arrayList.size(); i3++) {
                arrayList2.add(new PieEntry((float) ((Double.valueOf(arrayList.get(i3).getArea()).doubleValue() / d) * 100.0d), arrayList.get(i3).getName()));
            }
        }
        PieDataSet pieDataSet = new PieDataSet(arrayList2, "Election Results");
        pieDataSet.setSliceSpace(1.0f);
        pieDataSet.setSelectionShift(5.0f);
        pieDataSet.setValueLineColor(ContextCompat.getColor(this, R.color.colorPrimary));
        ArrayList arrayList3 = new ArrayList();
        for (int i4 : ColorTemplate.VORDIPLOM_COLORS) {
            arrayList3.add(Integer.valueOf(i4));
        }
        for (int i5 : ColorTemplate.JOYFUL_COLORS) {
            arrayList3.add(Integer.valueOf(i5));
        }
        for (int i6 : ColorTemplate.COLORFUL_COLORS) {
            arrayList3.add(Integer.valueOf(i6));
        }
        for (int i7 : ColorTemplate.LIBERTY_COLORS) {
            arrayList3.add(Integer.valueOf(i7));
        }
        for (int i8 : ColorTemplate.PASTEL_COLORS) {
            arrayList3.add(Integer.valueOf(i8));
        }
        arrayList3.add(Integer.valueOf(ColorTemplate.getHoloBlue()));
        pieDataSet.setColors(arrayList3);
        pieDataSet.setValueLinePart1OffsetPercentage(100.0f);
        pieDataSet.setValueLinePart1Length(0.6f);
        pieDataSet.setValueLinePart2Length(0.4f);
        PieData pieData = new PieData(pieDataSet);
        pieData.setDrawValues(false);
        pieData.setValueTextColor(-16777216);
        pieData.setValueTextSize(8.0f);
        pieData.setValueFormatter(new PercentFormatter());
        this.pieChart.setData(pieData);
        this.pieChart.highlightValues(null);
        this.pieChart.invalidate();
    }

    @Override // androidx.appcompat.app.AppCompatActivity, android.app.Activity, android.view.KeyEvent.Callback
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        if (i == 4 && keyEvent.getAction() == 0) {
            if (System.currentTimeMillis() - this.exitTime > Foreground.CHECK_DELAY) {
                showToast("再按一次退出程序");
                this.exitTime = System.currentTimeMillis();
                return true;
            }
            finish();
            return true;
        }
        return super.onKeyDown(i, keyEvent);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public float getRotate(double d, double d2, double d3, double d4, double d5, double d6) {
        double hypot = Math.hypot(d5 - d, d6 - d2);
        double hypot2 = Math.hypot(d5 - d3, d6 - d4);
        double hypot3 = Math.hypot(d3 - d, d4 - d2);
        double d7 = (((hypot * hypot) + (hypot2 * hypot2)) - (hypot3 * hypot3)) / ((hypot2 * 2.0d) * hypot);
        if (d7 >= 1.0d) {
            d7 = 1.0d;
        } else if (d7 < -1.0d) {
            d7 = -1.0d;
        }
        boolean z = ((d - d5) * (d4 - d6)) - ((d2 - d6) * (d3 - d5)) > Utils.DOUBLE_EPSILON;
        double degrees = Math.toDegrees(Math.acos(d7));
        if (!z) {
            degrees = -degrees;
        }
        return (float) degrees;
    }

    boolean mapContains(Layer layer) {
        return Arrays.asList(this.map.getLayers()).contains(layer);
    }

    public ArrayList<String> getLayer() {
        ArrayList<String> arrayList = new ArrayList<>();
        for (Layer layer : this.map.getLayers()) {
            arrayList.add(layer.getName());
        }
        return arrayList;
    }

    void getAppVersion() {
        HashMap hashMap = new HashMap();
        hashMap.put("api_token", Constant.API_TOKEN);
        hashMap.put("type", "android");
        ((MainPresenter) this.presenter).getAppVersion(Constant.FIR_IM_VERSION_URL + getPackageName() + "?", hashMap);
    }

    public void setUpdateCounts(int i) {
        this.tvCount.setVisibility(i > 0 ? 0 : 8);
        TextView textView = this.tvCount;
        textView.setText(i + "");
        this.strDownloadOK = "1";
    }

    private void test_() {
        this.ivRose.setImageResource(R.drawable.ic_launcher_background);
        L.e("test_111111111");
        ArcGISDynamicMapServiceLayer arcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://172.16.0.25:6080/arcgis/rest/services/2022/202203_SGDOM_2m_40");
        String name = arcGISDynamicMapServiceLayer.getName();
        Log.e(name, "" + arcGISDynamicMapServiceLayer.getUrl());
        arcGISDynamicMapServiceLayer.setName("测试");
        arcGISDynamicMapServiceLayer.setOnStatusChangedListener(new OnStatusChangedListener() { // from class: com.gisocn.onemap.ui.activity.MainActivity.73
            @Override // com.esri.android.map.event.OnStatusChangedListener
            public void onStatusChanged(Object obj, OnStatusChangedListener.STATUS status) {
                L.e("test_____" + status.name());
            }
        });
        this.map.addLayer(arcGISDynamicMapServiceLayer);
    }

    void singleQuery(float f, float f2) {
        boolean z;
        int i;
        Layer[] layerArr;
        this.asyncTaskIndex = 0;
        this.list.clear();
        this.singleGeometries.clear();
        disMissAllPopupWindow();
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        Layer[] layers = this.map.getLayers();
        int length = layers.length;
        int i2 = 0;
        while (i2 < length) {
            Layer layer = layers[i2];
            StringBuilder sb = new StringBuilder();
            sb.append("图层名称:");
            Layer[] layerArr2 = layers;
            sb.append(layer.getName());
            sb.append("是否显示:");
            int i3 = length;
            sb.append(layer.isVisible());
            sb.append("------");
            sb.append(layer.isInitialized());
            sb.append("-------");
            sb.append(layer.isRecycled());
            L.e(sb.toString());
            if (!layer.getName().equals("IMG_C") && !layer.getName().equals("VEC_C") && !layer.getName().equals("CIA_C") && !layer.getName().equals("CVA_C") && layer.isVisible()) {
                L.e("图层名称:" + layer.getName() + "是否显示:" + layer.isVisible());
                if (layer instanceof ArcGISLocalTiledLayer) {
                    if (GeometryEngine.intersects(layer.getExtent(), this.map.toMapPoint(f, f2), this.map.getSpatialReference())) {
                        L.e("");
                    }
                    L.e("singleQuery____" + layer.getName());
                    if (!isNull(layer.getName())) {
                        arrayList.add(layer);
                    }
                } else if ((layer instanceof GraphicsLayer) && ((GraphicsLayer) layer).getGraphicIDs() != null) {
                    if (!isNull(layer.getName())) {
                        arrayList.add(layer);
                    }
                } else if ((layer instanceof ArcGISDynamicMapServiceLayer) || (layer instanceof ArcGISTiledMapServiceLayer)) {
                    L.e(layer.getName());
                    arrayList2.add(layer);
                }
            }
            i2++;
            layers = layerArr2;
            length = i3;
        }
        if (arrayList.size() > 0) {
            Point mapPoint = this.map.toMapPoint(f, f2);
            double d = 20;
            double resolution = this.map.getResolution();
            Double.isNaN(d);
            double resolution2 = this.map.getResolution();
            Double.isNaN(d);
            Envelope envelope = new Envelope(mapPoint, resolution * d, resolution2 * d);
            this.tpkQueryEnd = false;
            ((MainPresenter) this.presenter).sqlQuery(arrayList, envelope, this.map.toMapPoint(f, f2), Constant.WKID, this.map.getSpatialReference());
        } else {
            this.tpkQueryEnd = true;
        }
        this.dynamicLayerInfoList.clear();
        this.dynamicInfoList.clear();
        this.asyncQueryTasks.clear();
        this.queryUrls.clear();
        this.layerInfoList.clear();
        Layer[] layers2 = this.map.getLayers();
        int length2 = layers2.length;
        int i4 = 0;
        while (i4 < length2) {
            Layer layer2 = layers2[i4];
            if (layer2.isVisible() && ((((z = layer2 instanceof ArcGISDynamicMapServiceLayer)) || (layer2 instanceof ArcGISTiledMapServiceLayer)) && !layer2.getName().equals("IMG_C") && !layer2.getName().equals("VEC_C") && !layer2.getName().equals("CIA_C") && !layer2.getName().equals("CVA_C"))) {
                L.e("layer.getName()" + layer2.getName());
                if (z) {
                    ArcGISLayerInfo[] layers3 = ((ArcGISDynamicMapServiceLayer) layer2).getLayers();
                    if (layers3 != null) {
                        getLayerInfo(layers3);
                    }
                    Iterator<LayerInfoBean> it = this.layerList.iterator();
                    while (true) {
                        if (!it.hasNext()) {
                            i = -1;
                            break;
                        }
                        LayerInfoBean next = it.next();
                        if (next.getName().equals(layer2.getName())) {
                            L.e(layer2.getName() + "getShowlayers" + next.getShowlayers() + "getShowlayers" + next.getService());
                            ArrayList arrayList3 = (ArrayList) new Gson().fromJson(next.getShowlayers(), new TypeToken<ArrayList<Integer>>() { // from class: com.gisocn.onemap.ui.activity.MainActivity.74
                            }.getType());
                            if (arrayList3 != null) {
                                int size = arrayList3.size();
                                int[] iArr = new int[size];
                                for (int i5 = 0; i5 < arrayList3.size(); i5++) {
                                    iArr[i5] = ((Integer) arrayList3.get(i5)).intValue();
                                }
                                i = iArr[size - 1];
                            } else {
                                next.getService();
                            }
                        }
                    }
                    Iterator<ArcGISLayerInfo> it2 = this.layerInfoList.iterator();
                    while (it2.hasNext()) {
                        ArcGISLayerInfo next2 = it2.next();
                        if (next2.getId() == i && next2.isVisible()) {
                            if (!isNull(layer2.getQueryUrl(next2.getId()))) {
                                L.e("layerInfoList>>>>>>>>>>>>>>" + i + next2.getName());
                                this.queryUrl = layer2.getQueryUrl(next2.getId());
                                next2.getLayerServiceInfo().getDisplayField();
                                if (!this.queryUrls.contains(this.queryUrl)) {
                                    this.queryUrls.add(this.queryUrl);
                                    layerArr = layers2;
                                    this.asyncQueryTasks.add(new AsyncQueryTask(this.queryUrl, layer2.getName(), next2.getName()));
                                }
                            }
                            layerArr = layers2;
                        } else {
                            layerArr = layers2;
                            if (i == -1 && next2.isVisible()) {
                                L.e("id == -1" + next2.getName());
                                String queryUrl = layer2.getQueryUrl(next2.getId());
                                this.queryUrl = queryUrl;
                                if (!this.queryUrls.contains(queryUrl)) {
                                    this.queryUrls.add(this.queryUrl);
                                    this.asyncQueryTasks.add(new AsyncQueryTask(this.queryUrl, layer2.getName(), next2.getName()));
                                }
                                L.e("id == -1  queryUrl" + this.queryUrl);
                            }
                        }
                        layers2 = layerArr;
                    }
                }
            }
            i4++;
            layers2 = layers2;
        }
        if (!this.isStart) {
            this.asyncTaskIndex = 0;
        }
        L.e("AsyncQueryTask_AsyncQueryTask" + this.asyncQueryTasks.size());
        if (this.asyncQueryTasks.size() > 0) {
            this.dynamicQueryEnd = false;
            showProgressDialog("查询中...");
            Iterator<AsyncQueryTask> it3 = this.asyncQueryTasks.iterator();
            while (it3.hasNext()) {
                AsyncQueryTask next3 = it3.next();
                L.e("查询任务" + next3.name + "" + next3.url);
                if (next3.getStatus() == AsyncTask.Status.PENDING) {
                    next3.execute(Float.valueOf(f), Float.valueOf(f2));
                }
            }
            return;
        }
        this.dynamicQueryEnd = true;
    }

    void getLayerInfo(ArcGISLayerInfo[] arcGISLayerInfoArr) {
        for (int i = 0; i < arcGISLayerInfoArr.length; i++) {
            if (arcGISLayerInfoArr[i].getLayers().length > 0) {
                getLayerInfo(arcGISLayerInfoArr[i].getLayers());
            } else {
                this.layerInfoList.add(arcGISLayerInfoArr[i]);
            }
        }
    }

    public void setViewPagerVisibility(boolean z) {
        this.viewPager.setVisibility(z ? 0 : 8);
    }

    public boolean isBaseMap(String str) {
        return this.baseMapNames.contains(str);
    }

    public MapView getMapView() {
        return this.map;
    }

    void switchBaseMap(String str) {
        Layer[] layers;
        Layer[] layers2;
        this.imgcOpen = false;
        if (TDTConstant.LAYER_NAME_VECTOR.equals(str)) {
            this.ll_ll_imgc_image.setVisibility(0);
            this.ll_imgc_vec.setVisibility(8);
            this.ll_imgc_recycle.setVisibility(8);
            this.ll_imgc_switch.setVisibility(0);
            Glide.with((FragmentActivity) this).load(Integer.valueOf(this.imgcOpen ? R.mipmap.ic_imgc_open : R.mipmap.ic_imgc_close)).into(this.iv_shrinkage_action);
            this.isImageMap = true;
            if (this.imgcSwitchList.size() > 0) {
                this.ll_imgc_switch.setVisibility(0);
                this.imgcSwitchAdapter.notifyDataSetChanged();
            } else {
                showToast("没有获取到影像数据！");
            }
            Iterator<ImgCLayer> it = this.imgcSwitchList.iterator();
            String str2 = "";
            while (it.hasNext()) {
                ImgCLayer next = it.next();
                if (next.isCheck()) {
                    str2 = next.getLayer().getName();
                }
            }
            this.tv_imgc_name.setText(str2);
            for (Layer layer : this.map.getLayers()) {
                L.e("底图图层" + layer.getName());
                if ("VEC_C".equals(layer.getName())) {
                    L.e("点击影像隐藏底图");
                    layer.setVisible(false);
                } else if ("IMG_C".equals(layer.getName()) || "CIA_C".equals(layer.getName()) || str2.equals(layer.getName())) {
                    layer.setVisible(true);
                }
            }
            return;
        }
        this.ll_ll_imgc_image.setVisibility(8);
        this.ll_imgc_vec.setVisibility(0);
        this.ll_imgc_switch.setVisibility(8);
        this.isImageMap = false;
        for (Layer layer2 : this.map.getLayers()) {
            L.e("底图图层" + layer2.getName());
            if ("VEC_C".equals(layer2.getName())) {
                layer2.setVisible(true);
            } else if ("IMG_C".equals(layer2.getName()) || "CIA_C".equals(layer2.getName()) || this.imgcSwitchListNames.contains(layer2.getName())) {
                layer2.setVisible(false);
            }
        }
    }

    public void localSearchGd(LatLonPoint latLonPoint) {
        if (latLonPoint == null) {
            return;
        }
        Point point = new Point(GCJ2WGSUtils.WGSLon(latLonPoint.getLatitude(), latLonPoint.getLongitude()), GCJ2WGSUtils.WGSLat(latLonPoint.getLatitude(), latLonPoint.getLongitude()));
        Log.e("wgspoint", point.getX() + "");
        Log.e("wgspoint", point.getY() + "");
        Point point2 = (Point) GeometryEngine.project(point, SpatialReference.create(4326), this.map.getSpatialReference());
        Log.e("mapPoint", point2.getY() + "");
        this.map.setExtent(point2);
        loadGeometryLocal(point2, "定位");
        this.map.setScale(2000.0d);
    }

    void test() {
        Gson gson = new Gson();
        ArrayList arrayList = (ArrayList) gson.fromJson(SpUtils.get(this, "downloadInfo", "") + "", new TypeToken<List<LocalFileInfo>>() { // from class: com.gisocn.onemap.ui.activity.MainActivity.75
        }.getType());
        if (arrayList != null) {
            TextView textView = (TextView) findViewById(R.id.test);
            this.test = textView;
            textView.setVisibility(0);
            this.test.setText(new Gson().toJson(arrayList));
        }
    }
}
